From: michael Date: Sat, 24 Feb 2007 14:28:49 +0000 (+0000) Subject: Halleluja X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/usb-driver/commitdiff_plain/d0676964410af2cfc01a121df39943be62d93fa8 Halleluja faking USB_GET_DEVICE_DATA unique: 110, bytes: 276, options: 0 Vendor: 3fd Calling setinterface num=0, alternate=0. DeviceAttach: received and accepted attach for: vendor id 0x3fd, product id 0x8, device handle 0x8215178 Cable PID = 0008. Max current requested during enumeration is 280 mA. in USB_TRANSFER unique: 110, pipe: 0, read: 1, options: 0, size: 1, timeout: bb8 setup packet: c0 b0 20 00 00 00 01 00 Transferred: 0 (read) Loopback test failed. Sent character = 00, Received character = 1A. Cable connection failed. --- diff --git a/usb-driver.c b/usb-driver.c index 31495ff..109f01d 100644 --- a/usb-driver.c +++ b/usb-driver.c @@ -225,7 +225,6 @@ int do_wdioctl(int fd, unsigned int request, unsigned char *wdioctl) { return (*ioctl_func) (fd, request, wdioctl); } - fprintf(stderr,"PID %d: ",getpid()); switch(request) { case VERSION: version = (struct version_struct*)(wdheader->data); @@ -280,7 +279,6 @@ int do_wdioctl(int fd, unsigned int request, unsigned char *wdioctl) { { struct interrupt *it = (struct interrupt*)(wdheader->data); - hexdump(wdheader->data, wdheader->size); fprintf(stderr,"Handle: %lu, Options: %lx, ncmds: %lu, enableok: %lu, count: %lu, lost: %lu, stopped: %lu\n", it->hInterrupt, it->dwOptions, it->dwCmds, it->fEnableOk, it->dwCounter, it->dwLost, it->fStopped); it->fEnableOk = 1; @@ -317,12 +315,18 @@ int do_wdioctl(int fd, unsigned int request, unsigned char *wdioctl) { ret = (*ioctl_func) (fd, request, wdioctl); #else if (usbdevice) { - int iface; - if (!usb_devhandle) usb_devhandle = usb_open(usbdevice); -//MGMG - ret = usb_claim_interface(usb_devhandle, iface); + + /* FIXME: Select right interface! */ + ret = usb_claim_interface(usb_devhandle, usbdevice->config[0].interface[usi->dwInterfaceNum].altsetting[usi->dwAlternateSetting].bInterfaceNumber); + if (!ret) { + ret = usb_set_altinterface(usb_devhandle, usi->dwAlternateSetting); + if (ret) + fprintf(stderr, "usb_set_altinterface: %d\n", ret); + } else { + fprintf(stderr, "usb_claim_interface: %d -> %d (%s)\n", usbdevice->config[0].interface[usi->dwInterfaceNum].altsetting[usi->dwAlternateSetting].bInterfaceNumber, ret, usb_strerror()); + } } #endif fprintf(stderr,"unique: %lu, interfacenum: %lu, alternatesetting: %lu, options: %lx\n", usi->dwUniqueID, usi->dwInterfaceNum, usi->dwAlternateSetting, usi->dwOptions); @@ -429,7 +433,6 @@ int do_wdioctl(int fd, unsigned int request, unsigned char *wdioctl) { { struct interrupt *it = (struct interrupt*)(wdheader->data); - hexdump(wdheader->data, wdheader->size); fprintf(stderr,"Handle: %lu, Options: %lx, ncmds: %lu, enableok: %lu, count: %lu, lost: %lu, stopped: %lu\n", it->hInterrupt, it->dwOptions, it->dwCmds, it->fEnableOk, it->dwCounter, it->dwLost, it->fStopped); #ifndef NO_WINDRVR