[tuxdroid-svn] r286 - svnlook: warning: cannot set LC_CTYPE locale svnlook: warning: environment va
Status: Beta
Brought to you by:
ks156
From: svnlook:warning@affinitic.be:cannot s. L. l. <c2m...@c2...> - 2007-04-22 18:12:33
|
Author: svnlook: warning: cannot set LC_CTYPE locale Date: svnlook: warning: environment variable LANG is EN New Revision: 286 Modified: firmware/tuxup/trunk/bootloader.c firmware/tuxup/trunk/bootloader.h firmware/tuxup/trunk/main.c firmware/tuxup/trunk/tux-api.h firmware/tuxup/trunk/usb-connection.c firmware/tuxup/trunk/usb-connection.h Log: doegox 2007-04-22 20:12:01 +0200 (Sun, 22 Apr 2007) 147 Reindent with: indent -nut -i4 -bad -bap -sob -sc -bl -bli0 -cli0 -cbi4 -nce -ncdw -ss -bls -npsl -ncs -npcs -nprs -saf -sai -saw -nbfda -nhnl -l80 svnlook: warning: cannot set LC_CTYPE locale svnlook: warning: environment variable LANG is EN svnlook: warning: please check that your locale name is correct Modified: firmware/tuxup/trunk/bootloader.c =================================================================== --- firmware/tuxup/trunk/bootloader.c 2007-04-22 18:09:42 UTC (rev 285) +++ firmware/tuxup/trunk/bootloader.c 2007-04-22 18:12:01 UTC (rev 286) @@ -58,53 +58,53 @@ const char *hexFile = NULL; -typedef uint32_t FILE_Addr_t; -typedef uint32_t FILE_SegmentLen_t; -typedef unsigned FILE_LineNum_t; -typedef uint8_t FILE_ParsedLen_t; +typedef uint32_t FILE_Addr_t; +typedef uint32_t FILE_SegmentLen_t; +typedef unsigned FILE_LineNum_t; +typedef uint8_t FILE_ParsedLen_t; enum mem_type_t mem_type; typedef struct { - FILE_LineNum_t lineNum; /* Line number of data record in ASCII file.*/ - FILE_Addr_t addr; /* Address that was parsed */ - FILE_ParsedLen_t dataLen; /* Number of bytes of data */ - FILE_ParsedLen_t dataAlloc; /* Number of bytes allocated */ - uint8_t *data; /* Data that was parsed */ + FILE_LineNum_t lineNum; /* Line number of data record in ASCII file. */ + FILE_Addr_t addr; /* Address that was parsed */ + FILE_ParsedLen_t dataLen; /* Number of bytes of data */ + FILE_ParsedLen_t dataAlloc; /* Number of bytes allocated */ + uint8_t *data; /* Data that was parsed */ } FILE_ParsedData_t; typedef struct { - FILE_LineNum_t lineNum; /* Tracks line number we're working on */ - FILE_ParsedData_t parsedData; /* Last hunk of data parsed */ - FILE_Addr_t segAddr; /* Address of the segment in memory */ - FILE_SegmentLen_t segLen; /* Length of the segment in memory */ - int inSeg; /* We've started a segment which hasn't been finished yet */ - FILE_Addr_t currAddr; /* The current address in memory being processed */ - uint8_t *segmentData; /* Complete segment data */ - int segmentDataIdx; /* index used for filling in the segment data */ - usb_dev_handle *dev_handle; /* usb device handle for sending parsed data */ + FILE_LineNum_t lineNum; /* Tracks line number we're working on */ + FILE_ParsedData_t parsedData; /* Last hunk of data parsed */ + FILE_Addr_t segAddr; /* Address of the segment in memory */ + FILE_SegmentLen_t segLen; /* Length of the segment in memory */ + int inSeg; /* We've started a segment which hasn't been finished yet */ + FILE_Addr_t currAddr; /* The current address in memory being processed */ + uint8_t *segmentData; /* Complete segment data */ + int segmentDataIdx; /* index used for filling in the segment data */ + usb_dev_handle *dev_handle; /* usb device handle for sending parsed data */ } Parser_t; /** * Clears any data stored in the parsed data */ -void ClearData(FILE_ParsedData_t *parsedData) +void ClearData(FILE_ParsedData_t * parsedData) { if (parsedData->dataAlloc > 0) { memset(parsedData->data, 0, parsedData->dataAlloc); } -} // ClearData +} // ClearData /** * Releases any allocated data in the parsed data buffer. */ -void FreeData(FILE_ParsedData_t *parsedData) +void FreeData(FILE_ParsedData_t * parsedData) { if (parsedData->dataAlloc > 0) { @@ -113,14 +113,13 @@ parsedData->dataAlloc = 0; } -} // FreeData +} // FreeData - /** * Allocates (or reallocates) the data buffer */ -uint8_t *AllocData(FILE_ParsedData_t *parsedData, FILE_ParsedLen_t reqLen) +uint8_t *AllocData(FILE_ParsedData_t * parsedData, FILE_ParsedLen_t reqLen) { if (reqLen <= parsedData->dataAlloc) { @@ -138,23 +137,19 @@ return parsedData->data; -} // AllocData +} // AllocData - - /** * Parses a single nibble from a string containing ASCII Hex characters. * * @return TRUE, if a nibble was parsed successfully, FALSE otherwise. */ -int GetNibble -( - Parser_t *parser, ///< (mod) Parser object that we're reporting about. - const char **s, ///< (mod) Pointer to string. Will be advanced. - unsigned char *b , ///< (out) nibble that was parsed. - const char *label ///< (in) Error string (used for reporting errors). -) +int GetNibble(Parser_t * parser, ///< (mod) Parser object that we're reporting about. + const char **s, ///< (mod) Pointer to string. Will be advanced. + unsigned char *b, ///< (out) nibble that was parsed. + const char *label ///< (in) Error string (used for reporting errors). + ) { char ch = **s; @@ -162,53 +157,50 @@ if ((ch >= '0') && (ch <= '9')) { - *b = ch - '0'; - return TRUE; + *b = ch - '0'; + return TRUE; } if ((ch >= 'A') && (ch <= 'F')) { - *b = ch - 'A' + 10; - return TRUE; + *b = ch - 'A' + 10; + return TRUE; } if ((ch >= 'a') && (ch <= 'f')) { - *b = ch - 'a' + 10; - return TRUE; + *b = ch - 'a' + 10; + return TRUE; } // Error(parser, "parsing %s, expecting hex digit, found '%c'", label, ch); return FALSE; - -} // GetNibble +} // GetNibble + /** * Parses a single byte from a string containing ASCII Hex characters. * * @return TRUE, if a byte was parsed successfully, FALSE otherwise. */ -int GetByte -( - Parser_t *parser, ///< (mod) Parser object that we're reporting about. - const char **s, ///< (mod) Pointer to string. Will be advanced. - unsigned char *b , ///< (out) nibble that was parsed. - const char *label ///< (in) Error string (used for reporting errors). -) +int GetByte(Parser_t * parser, ///< (mod) Parser object that we're reporting about. + const char **s, ///< (mod) Pointer to string. Will be advanced. + unsigned char *b, ///< (out) nibble that was parsed. + const char *label ///< (in) Error string (used for reporting errors). + ) { - unsigned char b1, b2; + unsigned char b1, b2; - if (GetNibble(parser, s, &b1, label) - && GetNibble(parser, s, &b2, label)) + if (GetNibble(parser, s, &b1, label) && GetNibble(parser, s, &b2, label)) { - *b = b1 << 4 | b2; - return TRUE; + *b = b1 << 4 | b2; + return TRUE; } return FALSE; -} // GetByte +} // GetByte /** * Parses two bytes from a string containing ASCII Hex characters. @@ -216,35 +208,33 @@ * @return TRUE, if a byte was parsed successfully, FALSE otherwise. */ -int GetWord -( - Parser_t *parser, ///< (mod) Parser object that we're reporting about. - const char **s, ///< (mod) Pointer to string. Will be advanced. - unsigned short *b , ///< (out) nibble that was parsed. - const char *label ///< (in) Error string (used for reporting errors). -) +int GetWord(Parser_t * parser, ///< (mod) Parser object that we're reporting about. + const char **s, ///< (mod) Pointer to string. Will be advanced. + unsigned short *b, ///< (out) nibble that was parsed. + const char *label ///< (in) Error string (used for reporting errors). + ) { - unsigned char b1, b2; + unsigned char b1, b2; - if (GetByte(parser, s, &b1, label) - && GetByte(parser, s, &b2, label)) + if (GetByte(parser, s, &b1, label) && GetByte(parser, s, &b2, label)) { - *b = (unsigned short)b1 << 8 | b2; - return TRUE; + *b = (unsigned short)b1 << 8 | b2; + return TRUE; } return FALSE; -} // GetWord +} // GetWord -int startSegment(Parser_t *parser) +int startSegment(Parser_t * parser) { parser->segmentDataIdx = 0; - /* set segment address */ - parser->segmentData[parser->segmentDataIdx++] = (uint8_t)(parser->segAddr >> 8); - parser->segmentData[parser->segmentDataIdx++] = (uint8_t)parser->segAddr; + /* set segment address */ + parser->segmentData[parser->segmentDataIdx++] = + (uint8_t) (parser->segAddr >> 8); + parser->segmentData[parser->segmentDataIdx++] = (uint8_t) parser->segAddr; /* fill with '0xFF' if necessary */ - while(parser->currAddr < parser->parsedData.addr) + while (parser->currAddr < parser->parsedData.addr) { parser->segmentData[parser->segmentDataIdx++] = 0xFF; parser->currAddr++; @@ -255,7 +245,7 @@ /** * Put one byte of data in the segmentData */ -int fillSegment(Parser_t *parser, uint8_t data) +int fillSegment(Parser_t * parser, uint8_t data) { parser->segmentData[parser->segmentDataIdx++] = data; parser->currAddr++; @@ -267,54 +257,60 @@ * * \todo remove the USB commands from here and put them in their own function */ -int finishSegment(Parser_t *parser) +int finishSegment(Parser_t * parser) { int i, idx = 0; uint8_t data_buffer[36]; int ret; - parser->inSeg = FALSE; /* inidicates that we completed a segment */ + parser->inSeg = FALSE; /* inidicates that we completed a segment */ #if (PRINT_DATA) printf("segment data: \n"); /* XXX debug */ - for (i=0; i<parser->segLen+2; i++) printf("%02x", parser->segmentData[i]); + for (i = 0; i < parser->segLen + 2; i++) + printf("%02x", parser->segmentData[i]); printf("\n"); #endif data_buffer[0] = LIBUSB_I2C_HEADER; data_buffer[1] = BOOT_FILLPAGE; - for (i=2; i<36; i++) data_buffer[i] = parser->segmentData[idx++]; /* send first packet */ + for (i = 2; i < 36; i++) + data_buffer[i] = parser->segmentData[idx++]; /* send first packet */ /* EEPROM handling */ if (mem_type == EEPROM) { - usleep(200000); /* try to solve the programming problem with some boards */ + usleep(200000); /* try to solve the programming problem with some boards */ data_buffer[2] |= 0x80; /* set the last bit to 1 to indicate eeprom type to the bootloader */ } ret = usb_send_commands(parser->dev_handle, data_buffer, 36); #if (PRINT_DATA) - printf("Status of the first packet sent: %d\n",ret); + printf("Status of the first packet sent: %d\n", ret); #endif - if (ret != 36) return FALSE; - for (i=2; i<34; i++) data_buffer[i] = parser->segmentData[idx++]; /* send second packet */ + if (ret != 36) + return FALSE; + for (i = 2; i < 34; i++) + data_buffer[i] = parser->segmentData[idx++]; /* send second packet */ keybreak(); ret = usb_send_commands(parser->dev_handle, data_buffer, 34); #if (PRINT_DATA) - printf("Status of the second packet sent: %d\n",ret); + printf("Status of the second packet sent: %d\n", ret); #endif - if (ret != 34) return FALSE; + if (ret != 34) + return FALSE; keybreak(); ret = usb_get_commands(parser->dev_handle, data_buffer, 5); #if (PRINT_DATA) - printf("Status of feedback from bootloader: %x\n",ret); + printf("Status of feedback from bootloader: %x\n", ret); #endif - if ((ret == 5) && (data_buffer[0] == 0xF0) && (data_buffer[1] == 0)) /* Bootlader status command and result */ + if ((ret == 5) && (data_buffer[0] == 0xF0) && (data_buffer[1] == 0)) /* Bootlader status command and result */ { printf("."); return TRUE; } else { - fprintf(stderr, "Bootloading failed, program aborted at dongle reply.\n"); + fprintf(stderr, + "Bootloading failed, program aborted at dongle reply.\n"); exit(1); } } @@ -327,9 +323,9 @@ * @return TRUE if parsing should continue, FALSE if it should stop. */ -int ParsedData(Parser_t *parser, int lastSeg) +int ParsedData(Parser_t * parser, int lastSeg) { - FILE_ParsedData_t *parsedData = &parser->parsedData; + FILE_ParsedData_t *parsedData = &parser->parsedData; /* Last segment, fill with '0xFF', send and return */ if (lastSeg) @@ -337,7 +333,7 @@ #if (PRINT_DATA) printf("--last segment --\n"); #endif - while (parser->currAddr < (parser->segAddr + parser->segLen)) /* fill with '0' until the end of segment */ + while (parser->currAddr < (parser->segAddr + parser->segLen)) /* fill with '0' until the end of segment */ { fillSegment(parser, 0xFF); } @@ -346,18 +342,18 @@ } /* resynchronise currAddr and addr */ - while(parser->currAddr != parsedData->addr) + while (parser->currAddr != parsedData->addr) { #if (PRINT_DATA) printf("--synchronisation--\n"); #endif if (!parser->inSeg) { - parser->currAddr = parsedData->addr & ~(parser->segLen - 1); /* set current address at the segment start by zeroing lower bits */ + parser->currAddr = parsedData->addr & ~(parser->segLen - 1); /* set current address at the segment start by zeroing lower bits */ break; } fillSegment(parser, 0xFF); - if (parser->currAddr == (parser->segAddr + parser->segLen)) /* end of segment */ + if (parser->currAddr == (parser->segAddr + parser->segLen)) /* end of segment */ { finishSegment(parser); } @@ -365,25 +361,26 @@ /* loop until all data has been processed */ int dataIdx = 0; - while(parser->currAddr < (parsedData->addr + parsedData->dataLen)) + + while (parser->currAddr < (parsedData->addr + parsedData->dataLen)) { #if (PRINT_DATA) printf("--loop--"); #endif - if (!parser->inSeg) /* start a new segment if needed */ + if (!parser->inSeg) /* start a new segment if needed */ { #if (PRINT_DATA) - printf("--new segment--\n"); + printf("--new segment--\n"); #endif parser->inSeg = TRUE; - parser->segAddr = parser->currAddr; /* set address of the segment start */ + parser->segAddr = parser->currAddr; /* set address of the segment start */ startSegment(parser); } - /* store data in segmentData */ + /* store data in segmentData */ fillSegment(parser, parsedData->data[dataIdx]); dataIdx++; - if (parser->currAddr == (parser->segAddr + parser->segLen)) /* end of segment */ + if (parser->currAddr == (parser->segAddr + parser->segLen)) /* end of segment */ { #if (PRINT_DATA) printf("--end segment--"); @@ -394,7 +391,7 @@ return TRUE; -} // ParsedData +} // ParsedData /** * Parses a single line from an Intel Hex file. @@ -416,11 +413,11 @@ * See: http://www.xess.com/faq/intelhex.pdf for the complete spec */ -int parseIHexLine(Parser_t *parser, const char *line) +int parseIHexLine(Parser_t * parser, const char *line) { - int i; - FILE_ParsedData_t *parsedData = &parser->parsedData; - uint8_t *data; + int i; + FILE_ParsedData_t *parsedData = &parser->parsedData; + uint8_t *data; ClearData(parsedData); @@ -432,8 +429,8 @@ return TRUE; } - const char *s = &line[ 1 ]; - unsigned char dataLen; + const char *s = &line[1]; + unsigned char dataLen; if (!GetByte(parser, &s, &dataLen, "count")) { @@ -442,27 +439,30 @@ data = AllocData(parsedData, dataLen); - unsigned short addr; + unsigned short addr; + if (!GetWord(parser, &s, &addr, "addr")) { return FALSE; } unsigned char recType; + if (!GetByte(parser, &s, &recType, "recType")) { return FALSE; } - unsigned char checksumCalc = dataLen + ((addr & 0xFF00) >> 8) + (addr & 0x00FF) + recType; + unsigned char checksumCalc = + dataLen + ((addr & 0xFF00) >> 8) + (addr & 0x00FF) + recType; - for (i = 0; i < dataLen; i++) + for (i = 0; i < dataLen; i++) { - if (!GetByte(parser, &s, &data[ i ], "data")) + if (!GetByte(parser, &s, &data[i], "data")) { return FALSE; } - checksumCalc += data[ i ]; + checksumCalc += data[i]; } unsigned char checksumFound; @@ -475,29 +475,29 @@ if ((unsigned char)(checksumCalc + checksumFound) != 0) { // Error(parser, "found checksum 0x%02x, expecting 0x%02x", - // checksumFound, 0 - checksumCalc); + // checksumFound, 0 - checksumCalc); return FALSE; } switch (recType) { - case 0: // Data + case 0: // Data { - parsedData->addr = addr; + parsedData->addr = addr; parsedData->dataLen = dataLen; ParsedData(parser, FALSE); break; } - case 1: // EOF + case 1: // EOF { - ParsedData(parser, TRUE); /* fill the last segment and send it */ + ParsedData(parser, TRUE); /* fill the last segment and send it */ // Flush(parser); /* XXX what to do here? */ break; } - default: + default: { // Error(parser, "Unrecognized record type: %d", recType); return FALSE; @@ -506,23 +506,23 @@ return TRUE; -} // parseIHexLine +} // parseIHexLine /** * Parses an intel hex file, calling the appropriate callbacks along the way */ -int FILE_ParseFile(usb_dev_handle *dev_h, const char *fileName) +int FILE_ParseFile(usb_dev_handle * dev_h, const char *fileName) { - FILE *fs = NULL; - Parser_t parser; - char line[ 100 ]; - int rc = FALSE; + FILE *fs = NULL; + Parser_t parser; + char line[100]; + int rc = FALSE; - memset(&parser, 0, sizeof(parser)); /* clear all parser elements */ + memset(&parser, 0, sizeof(parser)); /* clear all parser elements */ - parser.segLen = 0x40; /* TODO get this value from either the file or the main program. What if we get an ATM168? */ - parser.dev_handle = dev_h; /* XXX this is not a good way to pass the handle up to finsihSegment, any better idea? */ + parser.segLen = 0x40; /* TODO get this value from either the file or the main program. What if we get an ATM168? */ + parser.dev_handle = dev_h; /* XXX this is not a good way to pass the handle up to finsihSegment, any better idea? */ if ((parser.segmentData = malloc(parser.segLen + 2)) == NULL) { fprintf(stderr, "Unable to allocate segmentData space"); @@ -547,7 +547,7 @@ /* Everything went successfully */ rc = TRUE; -cleanup: + cleanup: if (fs != NULL) { @@ -557,19 +557,19 @@ return rc; -} // FILE_ParseFile +} // FILE_ParseFile - /** * Bootloads a CPU with the provided hex file */ -int bootload(usb_dev_handle *dev_h, uint8_t cpu_address, uint8_t mem_t, const char *filename) +int bootload(usb_dev_handle * dev_h, uint8_t cpu_address, uint8_t mem_t, + const char *filename) { - int rc = FALSE; + int rc = FALSE; uint8_t data_buffer[5]; - uint8_t page_size = 64; /* XXX should be adapted depending on the CPU type, how to do this? */ - uint8_t packet_total = 2; /* XXX should be adapted depending on the CPU type, how to do this? */ + uint8_t page_size = 64; /* XXX should be adapted depending on the CPU type, how to do this? */ + uint8_t packet_total = 2; /* XXX should be adapted depending on the CPU type, how to do this? */ int ret; /* Set global variable mem_type to the memory type */ @@ -581,15 +581,17 @@ data_buffer[2] = cpu_address; data_buffer[3] = page_size; data_buffer[4] = packet_total; - + ret = usb_send_commands(dev_h, data_buffer, 5); #if (PRINT_DATA) - printf("Boot init status: %x\n",ret); + printf("Boot init status: %x\n", ret); #endif - if (ret != 5) return FALSE; /* initialization failed */ + if (ret != 5) + return FALSE; /* initialization failed */ /* Bootloader: parse hex file and send data */ - if (FILE_ParseFile(dev_h, filename)) rc = TRUE; + if (FILE_ParseFile(dev_h, filename)) + rc = TRUE; /* Bootloader initialization */ data_buffer[0] = LIBUSB_I2C_HEADER; @@ -597,7 +599,7 @@ data_buffer[2] = 0; data_buffer[3] = 0; data_buffer[4] = 0; - + ret = usb_send_commands(dev_h, data_buffer, 5); return rc; } Modified: firmware/tuxup/trunk/bootloader.h =================================================================== --- firmware/tuxup/trunk/bootloader.h 2007-04-22 18:09:42 UTC (rev 285) +++ firmware/tuxup/trunk/bootloader.h 2007-04-22 18:12:01 UTC (rev 286) @@ -22,6 +22,7 @@ #ifndef bootloader_h #define bootloader_h -int bootload(usb_dev_handle *dev_h, uint8_t cpu_address, uint8_t mem_type, const char *filename); +int bootload(usb_dev_handle * dev_h, uint8_t cpu_address, uint8_t mem_type, + const char *filename); #endif Modified: firmware/tuxup/trunk/main.c =================================================================== --- firmware/tuxup/trunk/main.c 2007-04-22 18:09:42 UTC (rev 285) +++ firmware/tuxup/trunk/main.c 2007-04-22 18:12:01 UTC (rev 286) @@ -32,32 +32,33 @@ #include "common/commands.h" /* Messages. */ -const char * msg_old_firmware = \ -"\nERROR: Your dongle firmware is too old to support switching to bootloader"\ -"\nmode automatically.\n"\ -"\n To enter bootloading mode manually, you need to unplug the dongle, press"\ -"\n with a small pin on the button located inside the hole on the belly and,"\ -"\n while keeping it pressed, plug the dongle."\ -"\n The eyes should not turn blue at this time, otherwise try again."\ -"\n Now, reprogram the dongle alone with the command:"\ -"\n 'tuxup /opt/tuxdroid/hex/fusxusb.hex'"\ -"\n (You may use another path depending on the hex files"\ -" you want to use).\n"\ -"\nCheck http://www.tuxisalive.com/documentation/how-to/updating-the-firmware"\ -"\nfor more details.\n"; +const char *msg_old_firmware = + "\nERROR: Your dongle firmware is too old to support switching to bootloader" + "\nmode automatically.\n" + "\n To enter bootloading mode manually, you need to unplug the dongle, press" + "\n with a small pin on the button located inside the hole on the belly and," + "\n while keeping it pressed, plug the dongle." + "\n The eyes should not turn blue at this time, otherwise try again." + "\n Now, reprogram the dongle alone with the command:" + "\n 'tuxup /opt/tuxdroid/hex/fusxusb.hex'" + "\n (You may use another path depending on the hex files" + " you want to use).\n" + "\nCheck http://www.tuxisalive.com/documentation/how-to/updating-the-firmware" + "\nfor more details.\n"; -const char* msg_dfu_programmer_not_installed = \ -"\nERROR: dfu-programmer is not installed or is not in your path, tuxup uses"\ -"\nit to reprogram the USB cpu so installing dfu-programmer is mandatory.\n"; +const char *msg_dfu_programmer_not_installed = + "\nERROR: dfu-programmer is not installed or is not in your path, tuxup uses" + "\nit to reprogram the USB cpu so installing dfu-programmer is mandatory.\n"; /* Programming modes. */ -enum program_modes_t {NONE, ALL, MAIN, INPUTFILES}; +enum program_modes_t +{ NONE, ALL, MAIN, INPUTFILES }; /* The name of this program. */ -const char* program_name = "tuxup"; +const char *program_name = "tuxup"; /* The version defined in version.h */ -const char * program_version = VERSION; +const char *program_version = VERSION; /* Pointer o the input hex file */ FILE *hex_file; @@ -69,46 +70,44 @@ int pretend = 0; /* USB handle */ -struct usb_device* device; +struct usb_device *device; struct usb_dev_handle *dev_h; -int usb_connected = 0; /* Flag for usb connection status */ +int usb_connected = 0; /* Flag for usb connection status */ /* * Prints usage information for this program to STREAM (typically * stdout or stderr), and exit the program with EXIT_CODE. Does not return. */ -void usage (FILE* stream, int exit_code) +void usage(FILE * stream, int exit_code) { - fprintf(stream, "%s %s\n",program_name, program_version ); + fprintf(stream, "%s %s\n", program_name, program_version); fprintf(stream, "Usage: %s options [path|file ...]\n", program_name); - fprintf (stream, - " -m --main Reprogram tuxcore and tuxaudio (flash and eeprom) with hex files located in path.\n" - " -a --all Reprogram all cpu's with hex files located in path.\n" - " -p --pretend Don't do the programming, just simulates.\n" - " -h --help Display this usage information.\n" - " -v --verbose Print verbose messages.\n" - " -V --version Print the version number.\n" - "\n" - "Connection: connect the dongle alone, then press on tux's head\n" - " button while switching it on, finally connect the white cable\n" - " between tux and the dongle\n" - "\n" - "Notes: '-a' and -'m' options can't be used simultaneously.\n" - " Inputfiles can be specified only if the -a or -m options are\n" - " not selected.\n" - " Any .hex or .eep files compiled for Tux Droid can be used.\n" - " The eeprom file names should contain 'tuxcore' or 'tuxaudio'\n" - " in order to be identified, the usb hex file should contain\n" - " 'fuxusb'.\n" - ); - exit (exit_code); + fprintf(stream, + " -m --main Reprogram tuxcore and tuxaudio (flash and eeprom) with hex files located in path.\n" + " -a --all Reprogram all cpu's with hex files located in path.\n" + " -p --pretend Don't do the programming, just simulates.\n" + " -h --help Display this usage information.\n" + " -v --verbose Print verbose messages.\n" + " -V --version Print the version number.\n" "\n" + "Connection: connect the dongle alone, then press on tux's head\n" + " button while switching it on, finally connect the white cable\n" + " between tux and the dongle\n" "\n" + "Notes: '-a' and -'m' options can't be used simultaneously.\n" + " Inputfiles can be specified only if the -a or -m options are\n" + " not selected.\n" + " Any .hex or .eep files compiled for Tux Droid can be used.\n" + " The eeprom file names should contain 'tuxcore' or 'tuxaudio'\n" + " in order to be identified, the usb hex file should contain\n" + " 'fuxusb'.\n"); + exit(exit_code); } void fux_connect(void) { int wait = 5; - if (usb_connected) return; + if (usb_connected) + return; /* detect Tux on USB */ for (;;) @@ -116,14 +115,16 @@ device = usb_find_tux(); if (device == NULL) { - if (!wait) { + if (!wait) + { fprintf(stderr, "The dongle was not found, now exiting.\n"); exit(1); } } else { - if (verbose) printf("The dongle was found.\n"); + if (verbose) + printf("The dongle was found.\n"); /* Check if we have the old firmware that requires entering * bootloader mode manually, exits with a message that exlains what * to do in such a case. */ @@ -140,28 +141,34 @@ } /* open USB device */ - if ((dev_h = usb_open_tux(device))==NULL) { + if ((dev_h = usb_open_tux(device)) == NULL) + { fprintf(stderr, "USB DEVICE INIT ERROR \n"); exit(1); } - if (verbose) printf("Interface configured \n\n"); + if (verbose) + printf("Interface configured \n\n"); usb_connected = 1; } void fux_disconnect(void) { - if (!usb_connected) return; - if (verbose) printf("Closing interface ...\n"); + if (!usb_connected) + return; + if (verbose) + printf("Closing interface ...\n"); usb_release_interface(dev_h, USB_COMMAND); usb_close(dev_h); - if (verbose) printf(" ... interface closed \n"); + if (verbose) + printf(" ... interface closed \n"); usb_connected = 0; } int hex_to_i(char *hex_nr) { int nr; - sscanf(hex_nr,"%x",&nr); + + sscanf(hex_nr, "%x", &nr); return nr; } @@ -171,32 +178,33 @@ * from the hex file and returns 0 if the hex file has a cpu and version * numbers, 1 otherwise. */ -int check_hex_file(char *filename, version_bf_t* version) +int check_hex_file(char *filename, version_bf_t * version) { FILE *fs = NULL; char word[80]; char hex_nr[3]; - hex_nr[2]=(char)'\0'; + hex_nr[2] = (char)'\0'; if ((fs = fopen(filename, "r")) == NULL) { fprintf(stderr, "Unable to open file '%s' for reading\n", filename); exit(1); } - while( fscanf( fs, " %s", word)!=EOF) + while (fscanf(fs, " %s", word) != EOF) { /* look for the address 0EF0 or 1EF0 and the C8 version command */ - if (!strncmp(word, ":0C0EF000C8", 11) || !strncmp(word, ":0C1DF000C8", 11)) + if (!strncmp(word, ":0C0EF000C8", 11) + || !strncmp(word, ":0C1DF000C8", 11)) { /* get cpu number and version number */ strncpy(hex_nr, &word[11], 2); - version->cpu_nbr = (hex_to_i(hex_nr) & 0x7); /* 3 lower bits */ - version->ver_major = (hex_to_i(hex_nr) >> 3); /* 5 higher bits */ + version->cpu_nbr = (hex_to_i(hex_nr) & 0x7); /* 3 lower bits */ + version->ver_major = (hex_to_i(hex_nr) >> 3); /* 5 higher bits */ strncpy(hex_nr, &word[13], 2); - version->ver_minor = hex_to_i(hex_nr); /* 5 higher bits */ + version->ver_minor = hex_to_i(hex_nr); /* 5 higher bits */ strncpy(hex_nr, &word[15], 2); - version->ver_update = hex_to_i(hex_nr); /* 5 higher bits */ + version->ver_update = hex_to_i(hex_nr); /* 5 higher bits */ return 0; } } @@ -209,11 +217,14 @@ uint8_t cpu_i2c_addr; /* Connect the dongle. */ - if (!pretend) fux_connect(); + if (!pretend) + fux_connect(); if (check_hex_file(filename, &version)) { - printf("[FAIL] Programming of '%s' failed, this file is not a correct hex file for that CPU\n\n", filename); + printf + ("[FAIL] Programming of '%s' failed, this file is not a correct hex file for that CPU\n\n", + filename); return 1; } printf("Programming %s in the ", filename); @@ -239,12 +250,16 @@ } else { - printf("Unrecognized CPU number, %s doesn't appear to be compiled for a CPU of tuxdroid.\n", filename); + printf + ("Unrecognized CPU number, %s doesn't appear to be compiled for a CPU of tuxdroid.\n", + filename); return 1; } - printf ("Version %d.%d.%d\n", version.ver_major, version.ver_minor, version.ver_update); + printf("Version %d.%d.%d\n", version.ver_major, version.ver_minor, + version.ver_update); - if (pretend) return 0; + if (pretend) + return 0; if (bootload(dev_h, cpu_i2c_addr, FLASH, filename)) { @@ -261,7 +276,8 @@ uint8_t cpu_i2c_addr; /* Connect the dongle. */ - if (!pretend) fux_connect(); + if (!pretend) + fux_connect(); printf("Programming %s in ", filename); if (cpu_nbr == TUXCORE_CPU_NUM) @@ -280,7 +296,8 @@ return 0; } - if (pretend) return 0; + if (pretend) + return 0; if (bootload(dev_h, cpu_i2c_addr, EEPROM, filename)) { @@ -294,35 +311,41 @@ int prog_usb(char *filename) { - uint8_t send_data[5] = {0x01, 0x01, 0x00, 0x00, 0xFF}; /* XXX include those as defines in commands.h */ + uint8_t send_data[5] = { 0x01, 0x01, 0x00, 0x00, 0xFF }; /* XXX include those as defines in commands.h */ char tmp_string[90]; int ret; + printf("Programming %s in the USB CPU\n", filename); - if (pretend) return 0; + if (pretend) + return 0; /* Check if the dongle is already in bootloader mode */ if (verbose) { - fprintf(stdout,"Testing if the dongle is already in bootloader mode.\n"\ + fprintf(stdout, + "Testing if the dongle is already in bootloader mode.\n" "If it is not, 'no device present' will be reported.\n"); ret = system("dfu-programmer at89c5130 get bootloader-version"); } else - ret = system("dfu-programmer at89c5130 get bootloader-version 2> /dev/null"); + ret = + system + ("dfu-programmer at89c5130 get bootloader-version 2> /dev/null"); /* If dfu-programmer didn't detect the dongle, we try to set it in bootloader mode with the specific command */ if (ret) { /* Check if dfu-programmer is installed */ - if (ret == 32512) /* XXX a better way to code that error, a define? */ + if (ret == 32512) /* XXX a better way to code that error, a define? */ { fprintf(stdout, msg_dfu_programmer_not_installed); exit(1); } if (verbose) { - fprintf(stdout,"The dongle was not detected in bootloader mode, "\ + fprintf(stdout, + "The dongle was not detected in bootloader mode, " "now \ntrying to set it with a command.\n"); } fux_connect(); @@ -330,17 +353,17 @@ ret = usb_send_commands(dev_h, send_data, 5); if (ret == 5) { - if (verbose) fprintf(stdout, "Switched to bootloader mode.\n"); + if (verbose) + fprintf(stdout, "Switched to bootloader mode.\n"); sleep(2); } else { - fprintf (stderr, "Switching to bootloader mode failed.\n"); + fprintf(stderr, "Switching to bootloader mode failed.\n"); return 1; } } - ret = system("dfu-programmer at89c5130 erase"); if (ret) { @@ -374,53 +397,56 @@ { int ret = -1; size_t len; - char * extension, filenamepath[90]; + char *extension, filenamepath[90]; if (path) { /* Checking path */ len = strlen(path); - if (path[len-1] != '/') - strcat(path, "/"); /* Append '/' at the end if not specified. */ - strcpy (filenamepath, path); + if (path[len - 1] != '/') + strcat(path, "/"); /* Append '/' at the end if not specified. */ + strcpy(filenamepath, path); strcat(filenamepath, filename); filename = filenamepath; } - if (verbose) printf ("Processing: %s\n", filename); + if (verbose) + printf("Processing: %s\n", filename); extension = strrchr(filename, '.'); - if (extension) /* check that an extension has been given */ + if (extension) /* check that an extension has been given */ { /* Check which program function to start. */ if (!strcmp(extension, ".hex")) { int i, usb = 0; + /* Check for 'fuxusb' hex file. */ len = strlen(filename); - for (i=0; i< len-7; i++) + for (i = 0; i < len - 7; i++) { - if (!strncmp(filename+i, "fuxusb", 6)) + if (!strncmp(filename + i, "fuxusb", 6)) { ret = prog_usb(filename); usb = 1; break; } } - if (!usb) /* AVR hex file. */ + if (!usb) /* AVR hex file. */ ret = prog_flash(filename); } else if (!strcmp(extension, ".eep")) { int i; + len = strlen(filename); - for (i=0; i< len-7; i++) + for (i = 0; i < len - 7; i++) { - if (!strncmp(filename+i, "tuxcore", 7)) + if (!strncmp(filename + i, "tuxcore", 7)) { ret = prog_eeprom(TUXCORE_CPU_NUM, filename); break; } - else if (!strncmp(filename+i, "tuxaudio", 7)) + else if (!strncmp(filename + i, "tuxaudio", 7)) { ret = prog_eeprom(TUXAUDIO_CPU_NUM, filename); break; @@ -428,144 +454,157 @@ } } } - if (ret == -1) fprintf(stderr, "%s is not a valid programming file.\n", filename); - fprintf(stdout,"\n"); + if (ret == -1) + fprintf(stderr, "%s is not a valid programming file.\n", filename); + fprintf(stdout, "\n"); return ret; } /* * Main application */ -int main(int argc,char *argv[]) +int main(int argc, char *argv[]) { char path[90]; enum program_modes_t program_mode = NONE; time_t start_time, end_time; int next_option; + /* A string listing valid short options letters. */ - const char* const short_options = "maphvV"; + const char *const short_options = "maphvV"; + /* An array describing valid long options. */ const struct option long_options[] = { - { "main", 0, NULL, 'm' }, - { "all", 0, NULL, 'a' }, - { "pretend", 0, NULL, 'p' }, - { "help", 0, NULL, 'h' }, - { "verbose", 0, NULL, 'v' }, - { "version", 0, NULL, 'V' }, - { NULL, 0, NULL, 0 } /* Required at end of array. */ + {"main", 0, NULL, 'm'}, + {"all", 0, NULL, 'a'}, + {"pretend", 0, NULL, 'p'}, + {"help", 0, NULL, 'h'}, + {"verbose", 0, NULL, 'v'}, + {"version", 0, NULL, 'V'}, + {NULL, 0, NULL, 0} /* Required at end of array. */ }; /* Remember the name of the program, to incorporate in messages. - The name is stored in argv[0]. */ - /*program_name = argv[0];*/ + * The name is stored in argv[0]. */ + /*program_name = argv[0]; */ /* Save the start time to measure the programming time */ - start_time = time((time_t *)0); + start_time = time((time_t *) 0); - do { - next_option = getopt_long (argc, argv, short_options, - long_options, NULL); + do + { + next_option = + getopt_long(argc, argv, short_options, long_options, NULL); switch (next_option) { - case 'h': /* -h or --help */ - /* User has requested usage information. Print it to standard - output, and exit with exit code zero (normal termination). */ - usage(stdout, 0); - case 'm': /* -m or --main */ - if (program_mode == NONE) - program_mode = MAIN; - else - { - fprintf(stderr, "'-a' and '-m' options can't be used simultaneoulsy.\n\n"); - usage (stderr, 1); - } - break; - case 'a': /* -a or --all */ - if (program_mode == NONE) - program_mode = ALL; - else - { - fprintf(stderr, "'-a' and '-m' options can't be used simultaneoulsy.\n\n"); - usage (stderr, 1); - } - break; - case 'p': /* -a or --all */ - pretend = 1; - break; - case 'v': /* -v or --verbose */ - verbose = 1; - break; - case 'V': /* -V or --version */ - fprintf(stdout, "%s %s, an uploader program for tuxdroid.\n\n",program_name, program_version ); - exit(0); /* version is already printed, so just exit. */ - break; - case '?': /* The user specified an invalid option. */ - /* Print usage information to standard error, and exit with exit - code one (indicating abnormal termination). */ - usage (stderr, 1); - case -1: /* Done with options. */ - break; - default: /* Something else: unexpected. */ - abort (); + case 'h': /* -h or --help */ + /* User has requested usage information. Print it to standard + * output, and exit with exit code zero (normal termination). */ + usage(stdout, 0); + case 'm': /* -m or --main */ + if (program_mode == NONE) + program_mode = MAIN; + else + { + fprintf(stderr, + "'-a' and '-m' options can't be used simultaneoulsy.\n\n"); + usage(stderr, 1); + } + break; + case 'a': /* -a or --all */ + if (program_mode == NONE) + program_mode = ALL; + else + { + fprintf(stderr, + "'-a' and '-m' options can't be used simultaneoulsy.\n\n"); + usage(stderr, 1); + } + break; + case 'p': /* -a or --all */ + pretend = 1; + break; + case 'v': /* -v or --verbose */ + verbose = 1; + break; + case 'V': /* -V or --version */ + fprintf(stdout, "%s %s, an uploader program for tuxdroid.\n\n", + program_name, program_version); + exit(0); /* version is already printed, so just exit. */ + break; + case '?': /* The user specified an invalid option. */ + /* Print usage information to standard error, and exit with exit + * code one (indicating abnormal termination). */ + usage(stderr, 1); + case -1: /* Done with options. */ + break; + default: /* Something else: unexpected. */ + abort(); } } while (next_option != -1); /* Done with options. OPTIND points to first nonoption argument. */ /* Print program name and version at program launch */ - if (verbose) fprintf(stdout, "%s %s, an uploader program for tuxdroid.\n\n",program_name, program_version ); + if (verbose) + fprintf(stdout, "%s %s, an uploader program for tuxdroid.\n\n", + program_name, program_version); /* If no program mode has been selected, choose INPUTFILES. */ if (program_mode == NONE) program_mode = INPUTFILES; /* Check that if we have inputfiles, the correct program mode is selected */ - if (optind < argc) /* Input files have been given. */ + if (optind < argc) /* Input files have been given. */ { if (program_mode != INPUTFILES) { if (argc == optind + 1) strcpy(path, argv[optind]); else - usage (stderr, 1); + usage(stderr, 1); } } - else /* No arguments given. */ - usage (stderr, 1); + else /* No arguments given. */ + usage(stderr, 1); /* Select which files to program */ switch (program_mode) { int i; - case INPUTFILES: - for (i = optind; i < argc; ++i) - { - program(argv[i], NULL); /* XXX returned values are not used yet */ - } - break; - case MAIN: - program("tuxcore.hex", path); - program("tuxcore.eep", path); - program("tuxaudio.hex", path); - program("tuxaudio.eep", path); - break; - case ALL: - program("fuxusb.hex", path); - program("tuxcore.hex", path); - program("tuxcore.eep", path); - program("tuxaudio.hex", path); - program("tuxaudio.eep", path); - program("tuxrf.hex", path); - program("fuxrf.hex", path); - break; - default: - abort(); + + case INPUTFILES: + for (i = optind; i < argc; ++i) + { + program(argv[i], NULL); /* XXX returned values are not used yet */ + } + break; + case MAIN: + program("tuxcore.hex", path); + program("tuxcore.eep", path); + program("tuxaudio.hex", path); + program("tuxaudio.eep", path); + break; + case ALL: + program("fuxusb.hex", path); + program("tuxcore.hex", path); + program("tuxcore.eep", path); + program("tuxaudio.hex", path); + program("tuxaudio.eep", path); + program("tuxrf.hex", path); + program("fuxrf.hex", path); + break; + default: + abort(); } - if (!pretend) fux_disconnect(); + if (!pretend) + fux_disconnect(); /* Print time elapsed for programming. */ - end_time = time((time_t *)0); - if (!pretend) printf ("Time elapsed: %2.0f seconds.\n",difftime(end_time, start_time)); + end_time = time((time_t *) 0); + if (!pretend) + printf("Time elapsed: %2.0f seconds.\n", + difftime(end_time, start_time)); return 0; } Modified: firmware/tuxup/trunk/tux-api.h =================================================================== --- firmware/tuxup/trunk/tux-api.h 2007-04-22 18:09:42 UTC (rev 285) +++ firmware/tuxup/trunk/tux-api.h 2007-04-22 18:12:01 UTC (rev 286) @@ -20,7 +20,7 @@ /* $Id$ */ #ifndef TUX_API_H -#define TUX_API_H +#define TUX_API_H /** * USB command types @@ -29,6 +29,7 @@ #define LIBUSB_RF_HEADER 0 #define LIBUSB_I2C_HEADER 2 -enum mem_type_t {FLASH, EEPROM, EXTERNAL_FlasH}; +enum mem_type_t +{ FLASH, EEPROM, EXTERNAL_FlasH }; #endif /* TUX_API_H */ Modified: firmware/tuxup/trunk/usb-connection.c =================================================================== --- firmware/tuxup/trunk/usb-connection.c 2007-04-22 18:09:42 UTC (rev 285) +++ firmware/tuxup/trunk/usb-connection.c 2007-04-22 18:12:01 UTC (rev 286) @@ -21,7 +21,7 @@ #include <stdint.h> #include <stdio.h> -#include <usb.h> /* libusb header */ +#include <usb.h> /* libusb header */ #include <syslog.h> #include "usb-connection.h" @@ -43,25 +43,26 @@ * \brief Scan all USB busses to find Tux device * \return USB device of Tux */ -struct usb_device* usb_find_tux() +struct usb_device *usb_find_tux() { struct usb_bus *bus; struct usb_device *device; + usb_init(); usb_find_busses(); usb_find_devices(); - for(bus=usb_busses;bus;bus=bus->next) + for (bus = usb_busses; bus; bus = bus->next) { - for (device = bus->devices;device;device=device->next) + for (device = bus->devices; device; device = device->next) { - if ((device->descriptor.idVendor == TUX_VENDOR_ID) && - (device->descriptor.idProduct ==TUX_PRODUCT_ID)) + if ((device->descriptor.idVendor == TUX_VENDOR_ID) + && (device->descriptor.idProduct == TUX_PRODUCT_ID)) { return device; } } - } + } return NULL; } @@ -70,31 +71,32 @@ * \param dev USB device * \return dev_h USB device handle */ -usb_dev_handle * usb_open_tux(struct usb_device* dev) +usb_dev_handle *usb_open_tux(struct usb_device * dev) { int err; usb_dev_handle *dev_h; - if (!(dev_h=usb_open(dev))) + if (!(dev_h = usb_open(dev))) { - return NULL; + return NULL; } - else - if (verbose) printf("Device opened\n"); + else if (verbose) + printf("Device opened\n"); err = usb_claim_interface(dev_h, USB_COMMAND); if (err != 0) { usb_detach_kernel_driver_np(dev_h, USB_COMMAND); err = usb_claim_interface(dev_h, USB_COMMAND); - if (err !=0) + if (err != 0) { fprintf(stderr, "Claim interface failed: %s\n", usb_strerror()); usb_close(dev_h); return NULL; } } - if (verbose) printf("USB interface claimed successfully \n"); + if (verbose) + printf("USB interface claimed successfully \n"); return dev_h; } @@ -104,10 +106,10 @@ * * Releases and close the interface */ -void usb_close_tux(usb_dev_handle *dev_h) +void usb_close_tux(usb_dev_handle * dev_h) { usb_release_interface(dev_h, USB_COMMAND); - usb_close(dev_h); + usb_close(dev_h); } /** @@ -118,18 +120,25 @@ * \todo Need to define the format of the data array to send and pass it as parameter * \todo Need to add some doc or links about what this status is really */ -int usb_send_commands(usb_dev_handle *dev_h, uint8_t *send_data, int size) +int usb_send_commands(usb_dev_handle * dev_h, uint8_t * send_data, int size) { int status; - if((status = usb_interrupt_write(dev_h, USB_W_ENDPOINT, (char*)send_data, size, USB_W_TIMEOUT)) < 0) + + if ((status = + usb_interrupt_write(dev_h, USB_W_ENDPOINT, (char *)send_data, size, + USB_W_TIMEOUT)) < 0) /* error on usb_interrupt_write() */ - { - fprintf(stderr, "usb_interrupt_write error: status = %d :: %s \n", status, usb_strerror()); + { + fprintf(stderr, "usb_interrupt_write error: status = %d :: %s \n", + status, usb_strerror()); } - else /* success */ + else /* success */ { #if (PRINT_DATA) - printf("usb_interrupt_write: status =%d -> TX Buffer[%d]={%2X, %2X, %2X, %2X, %2X}\n", status, status, send_data[0], send_data[1], send_data[2], send_data[3], send_data[4]); + printf + ("usb_interrupt_write: status =%d -> TX Buffer[%d]={%2X, %2X, %2X, %2X, %2X}\n", + status, status, send_data[0], send_data[1], send_data[2], + send_data[3], send_data[4]); #endif } return status; @@ -143,22 +152,28 @@ * \todo Need to define the format of the data array to send and pass it as parameter * \todo Need to add some doc or links about what this status is really */ -int usb_get_commands(usb_dev_handle *dev_h, uint8_t *receive_data, int size) +int usb_get_commands(usb_dev_handle * dev_h, uint8_t * receive_data, int size) { int status; - if((status = usb_interrupt_read(dev_h, USB_R_ENDPOINT, (char*)receive_data, size, USB_R_TIMEOUT)) < 0) + if ((status = + usb_interrupt_read(dev_h, USB_R_ENDPOINT, (char *)receive_data, size, + USB_R_TIMEOUT)) < 0) { - fprintf(stderr, "usb_interrupt_read error: status = %d :: %s \n", status, usb_strerror()); + fprintf(stderr, "usb_interrupt_read error: status = %d :: %s \n", + status, usb_strerror()); } else { /* XXX this is only to test and display what has been received */ #if (PRINT_DATA) - printf("usb_interrupt_read: status = %d -> TX Buffer[%d]={%hX, %hX, %hX, %hX, %hX}\n", status, status, receive_data[0], receive_data[1], receive_data[2], receive_data[3], receive_data[4]); + printf + ("usb_interrupt_read: status = %d -> TX Buffer[%d]={%hX, %hX, %hX, %hX, %hX}\n", + status, status, receive_data[0], receive_data[1], receive_data[2], + receive_data[3], receive_data[4]); #endif } return status; } -/** @} */ /* end of USB group */ + /** @} *//* end of USB group */ Modified: firmware/tuxup/trunk/usb-connection.h =================================================================== --- firmware/tuxup/trunk/usb-connection.h 2007-04-22 18:09:42 UTC (rev 285) +++ firmware/tuxup/trunk/usb-connection.h 2007-04-22 18:12:01 UTC (rev 286) @@ -62,10 +62,10 @@ // }; /* Prototypes */ -usb_dev_handle * usb_open_tux(struct usb_device* dev); -struct usb_device* usb_find_tux(); -int usb_check_tux_status(usb_dev_handle *dev_h); -int usb_send_commands(usb_dev_handle *dev_h, uint8_t *send_data, int size); -int usb_get_commands(usb_dev_handle *dev_h, uint8_t *receive_data, int size); +usb_dev_handle *usb_open_tux(struct usb_device *dev); +struct usb_device *usb_find_tux(); +int usb_check_tux_status(usb_dev_handle * dev_h); +int usb_send_commands(usb_dev_handle * dev_h, uint8_t * send_data, int size); +int usb_get_commands(usb_dev_handle * dev_h, uint8_t * receive_data, int size); #endif /* USB_CONNECTION_H */ |