*** rockbox-3.2-orig/apps/iap.c 2009-03-23 23:26:07.000000000 +0100 --- rockbox-3.2-logs/apps/iap.c 2009-05-15 18:12:05.000000000 +0200 *************** *** 54,63 **** --- 54,98 ---- unsigned char serbuf[RX_BUFLEN]; static int serbuf_i = 0; + static int serbuf_size = 0; static unsigned char response[TX_BUFLEN]; static int responselen; + #define SERIAL_LOGFILE "/seriallog.txt" + + void serial_log_packet (const int in_packet, const char* data, const int size) + { + int fd; + int i; + int startindex; + + fd = open (SERIAL_LOGFILE,O_APPEND|O_CREAT|O_RDWR); + if (fd>=0) + { + if (in_packet) + { + fdprintf (fd,"--> "); + startindex = 0; + } + else + { + fdprintf (fd,"<-- "); + /* we don't need to print the heading marker FF 55 */ + startindex = 2; + } + + /* size-1 : don't print checksum */ + for (i=startindex;i= RX_BUFLEN) + { serbuf_i = 0; + serbuf_size = 0; + } serbuf[serbuf_i++] = x; + serbuf_size++; chksum += x; } last_x = x; *************** *** 222,227 **** --- 264,271 ---- return; } + serial_log_packet (1,serbuf,serbuf_size); + /* Handle Mode 0 */ if (serbuf[1] == 0x00) {