small fixes
still segfault
This commit is contained in:
parent
f95f1d2e4e
commit
792bf5f262
46
usb-driver.c
46
usb-driver.c
@ -32,6 +32,26 @@ static unsigned long card_type;
|
|||||||
void hexdump(unsigned char *buf, int len);
|
void hexdump(unsigned char *buf, int len);
|
||||||
void diff(unsigned char *buf1, unsigned char *buf2, int len);
|
void diff(unsigned char *buf1, unsigned char *buf2, int len);
|
||||||
|
|
||||||
|
//unique: 94, bytes: 276, options: 0
|
||||||
|
//Vendor: 3fd
|
||||||
|
//12 01 00 02 00 00 00 40 fd 03 08 00 00 00 01 02 12 01 00 02 00 00 00 40 fd 03 08 00 00 00 01 02
|
||||||
|
//00 01 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 40 00 00 00 00 00 00 00
|
||||||
|
//03 00 00 00 00 00 00 00 38 45 21 08 38 45 21 08 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||||
|
//4c 45 21 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||||
|
//00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||||
|
//00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||||
|
//00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||||
|
//00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||||
|
//00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||||
|
//00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||||
|
//00 00 00 00 00 00 00 00 09 02 20 00 01 02 00 80 00 00 00 00 00 00 00 00 09 02 20 00 01 02 00 80
|
||||||
|
//8c 00 00 00 01 00 00 00 4c 45 21 08 58 45 21 08 8c 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00
|
||||||
|
//01 00 00 00 58 45 21 08 09 04 00 00 02 ff 00 00 01 00 00 00 00 00 00 00 09 04 00 00 02 ff 00 00
|
||||||
|
//00 00 00 00 6c 45 21 08 7c 45 21 08 07 05 02 02 00 00 00 00 00 00 00 00 00 00 00 00 07 05 02 02
|
||||||
|
//00 02 00 00 07 05 86 02 00 02 00 00 02 00 00 00 00 02 00 00 07 05 86 02 00 02 00 00 02 00 00 00
|
||||||
|
//00 02 00 00 02 00 00 00 02 00 00 00 00 00 00 00 00 02 00 00 02 00 00 00 02 00 00 00 00 00 00 00
|
||||||
|
//86 00 00 00 00 02 00 00 02 00 00 00 01 00 00 00 86 00 00 00 00 02 00 00 02 00 00 00 01 00 00 00
|
||||||
|
//00 00 00 00 00 00 00 00
|
||||||
int usb_deviceinfo(unsigned char *buf) {
|
int usb_deviceinfo(unsigned char *buf) {
|
||||||
int i,j,k,l;
|
int i,j,k,l;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
@ -119,7 +139,6 @@ int usb_deviceinfo(unsigned char *buf) {
|
|||||||
if (buf) {
|
if (buf) {
|
||||||
for (l = 0; l < bNumEndpoints; l++) {
|
for (l = 0; l < bNumEndpoints; l++) {
|
||||||
WDU_ENDPOINT_DESCRIPTOR *ed = (WDU_ENDPOINT_DESCRIPTOR*)(buf+len);
|
WDU_ENDPOINT_DESCRIPTOR *ed = (WDU_ENDPOINT_DESCRIPTOR*)(buf+len);
|
||||||
WDU_PIPE_INFO *pi;
|
|
||||||
|
|
||||||
ed->bLength = interface->altsetting[k].endpoint[l].bLength;
|
ed->bLength = interface->altsetting[k].endpoint[l].bLength;
|
||||||
ed->bDescriptorType = interface->altsetting[k].endpoint[l].bDescriptorType;
|
ed->bDescriptorType = interface->altsetting[k].endpoint[l].bDescriptorType;
|
||||||
@ -129,8 +148,10 @@ int usb_deviceinfo(unsigned char *buf) {
|
|||||||
ed->bInterval = interface->altsetting[k].endpoint[l].bInterval;
|
ed->bInterval = interface->altsetting[k].endpoint[l].bInterval;
|
||||||
|
|
||||||
len += sizeof(WDU_ENDPOINT_DESCRIPTOR);
|
len += sizeof(WDU_ENDPOINT_DESCRIPTOR);
|
||||||
|
}
|
||||||
|
|
||||||
pi = (WDU_PIPE_INFO*)(buf+len);
|
for (l = 0; l < bNumEndpoints; l++) {
|
||||||
|
WDU_PIPE_INFO *pi = (WDU_PIPE_INFO*)(buf+len);
|
||||||
|
|
||||||
pi->dwNumber = interface->altsetting[k].endpoint[l].bEndpointAddress;
|
pi->dwNumber = interface->altsetting[k].endpoint[l].bEndpointAddress;
|
||||||
pi->dwMaximumPacketSize = WDU_GET_MAX_PACKET_SIZE(interface->altsetting[k].endpoint[l].wMaxPacketSize);
|
pi->dwMaximumPacketSize = WDU_GET_MAX_PACKET_SIZE(interface->altsetting[k].endpoint[l].wMaxPacketSize);
|
||||||
@ -272,27 +293,6 @@ int do_wdioctl(int fd, unsigned int request, unsigned char *wdioctl) {
|
|||||||
ugdd->dwBytes = usb_deviceinfo(NULL);
|
ugdd->dwBytes = usb_deviceinfo(NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//unique: 94, bytes: 276, options: 0
|
|
||||||
//Vendor: 3fd
|
|
||||||
//12 01 00 02 00 00 00 40 fd 03 08 00 00 00 01 02 12 01 00 02 00 00 00 40 fd 03 08 00 00 00 01 02
|
|
||||||
//00 01 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
||||||
//03 00 00 00 00 00 00 00 38 45 21 08 38 45 21 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
||||||
//4c 45 21 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
||||||
//00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
||||||
//00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
||||||
//00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
||||||
//00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
||||||
//00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
||||||
//00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
||||||
//00 00 00 00 00 00 00 00 09 02 20 00 01 02 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
||||||
//8c 00 00 00 01 00 00 00 4c 45 21 08 58 45 21 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
||||||
//01 00 00 00 58 45 21 08 09 04 00 00 02 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
||||||
//00 00 00 00 6c 45 21 08 7c 45 21 08 07 05 02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
||||||
//00 02 00 00 07 05 86 02 00 02 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
||||||
//00 02 00 00 02 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
||||||
//86 00 00 00 00 02 00 00 02 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
||||||
//00 00 00 00 00 00 00 00
|
|
||||||
|
|
||||||
usb_deviceinfo((unsigned char*)ugdd->pBuf);
|
usb_deviceinfo((unsigned char*)ugdd->pBuf);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user