From: michael Date: Sat, 24 Feb 2007 15:16:19 +0000 (+0000) Subject: Transferred: 180 (write) X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/usb-driver/commitdiff_plain/a70f4f388bbe08fbc80c4b587da4c0a781f475da Transferred: 180 (write) in USB_TRANSFER unique: 110, pipe: 134, read: 1, options: 0, size: 4, timeout: bb8 setup packet: 00 00 00 00 00 00 00 00 Transferred: 4 (read) Read: 00 00 18 37 CRC error : 0 RESERVED : 0 DCM locked : 1 DCI Matched : 1 legacy input error : 0 status of GTS_CFG_B : 1 status of GWE : 1 status of GHIGH : 1 value of MODE pin M0 : 0 value of MODE pin M1 : 0 value of MODE pin M2 : 0 value of CFG_RDY (INIT_B) : 1 DONEIN input from DONE pin : 1 ID_ERROR : 0 RESERVED : 0 RESERVED : 0 INFO:iMPACT:2219 - Status register values: INFO:iMPACT - 0011 0111 0001 1000 0000 0000 0000 0000 INFO:iMPACT:579 - '3': Completed downloading bit file to device. --- diff --git a/usb-driver.c b/usb-driver.c index e92467f..c4afaf5 100644 --- a/usb-driver.c +++ b/usb-driver.c @@ -249,7 +249,6 @@ int do_wdioctl(int fd, unsigned int request, unsigned char *wdioctl) { fprintf(stderr,"in USB_TRANSFER"); { struct usb_transfer *ut = (struct usb_transfer*)(wdheader->data); - int requesttype, request, value, index, size; fprintf(stderr," unique: %lu, pipe: %lu, read: %lu, options: %lx, size: %lu, timeout: %lx\n", ut->dwUniqueID, ut->dwPipeNum, ut->fRead, ut->dwOptions, ut->dwBufferSize, ut->dwTimeout); fprintf(stderr,"setup packet: "); @@ -265,20 +264,30 @@ int do_wdioctl(int fd, unsigned int request, unsigned char *wdioctl) { ret = (*ioctl_func) (fd, request, wdioctl); #else /* http://www.jungo.com/support/documentation/windriver/802/wdusb_man_mhtml/node55.html#SECTION001213000000000000000 */ - requesttype = ut->SetupPacket[0]; - request = ut->SetupPacket[1]; - value = ut->SetupPacket[2] | (ut->SetupPacket[3] << 8); - index = ut->SetupPacket[4] | (ut->SetupPacket[5] << 8); - size = ut->SetupPacket[6] | (ut->SetupPacket[7] << 8); - fprintf(stderr, "requesttype: %x, request: %x, value: %u, index: %u, size: %u\n", requesttype, request, value, index, size); - ret = usb_control_msg(usb_devhandle, requesttype, request, value, index, ut->pBuffer, size, ut->dwTimeout); + if (ut->dwPipeNum == 0) { /* control pipe */ + int requesttype, request, value, index, size; + requesttype = ut->SetupPacket[0]; + request = ut->SetupPacket[1]; + value = ut->SetupPacket[2] | (ut->SetupPacket[3] << 8); + index = ut->SetupPacket[4] | (ut->SetupPacket[5] << 8); + size = ut->SetupPacket[6] | (ut->SetupPacket[7] << 8); + fprintf(stderr, "requesttype: %x, request: %x, value: %u, index: %u, size: %u\n", requesttype, request, value, index, size); + ret = usb_control_msg(usb_devhandle, requesttype, request, value, index, ut->pBuffer, size, ut->dwTimeout); + } else { + if (ut->fRead) { + ret = usb_bulk_read(usb_devhandle, ut->dwPipeNum, ut->pBuffer, ut->dwBufferSize, ut->dwTimeout); + + } else { + ret = usb_bulk_write(usb_devhandle, ut->dwPipeNum, ut->pBuffer, ut->dwBufferSize, ut->dwTimeout); + } + } + if (ret < 0) { - fprintf(stderr, "usb_control_msg: %d\n", ret); + fprintf(stderr, "usb_transfer: %d (%s)\n", ret, usb_strerror()); } else { ut->dwBytesTransferred = ret; ret = 0; } - #endif fprintf(stderr,"Transferred: %lu (%s)\n",ut->dwBytesTransferred, (ut->fRead?"read":"write"));