<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Using Linux 3.x kernel and debian 6.0 stable distro.<br></div><div><br></div><div>USB flash program 1.3<br></div><div>http://code.google.com/p/mphidflash/<br></div><div><br></div><div>libhid 0.2.16<br></div><div><br></div><div>I have installed a Generic HID bootloader and a basic p18F2455 circuit setup for reading and writing USB data.</div><div>20mhz crystal no LEDs one jumper for bootloader mode and a switch for reset., nothing special. </div><div><br></div><div>When I plug it in and use the "dmesg" commandline program I get.</div><div><br></div><div>[19195.480407] usb 1-1.2: reset full speed USB device number 6 using ehci_hcd<br>[19238.616399] usb 1-1.4: new full speed USB device number 50 using ehci_hcd<br>[19238.711891] usb 1-1.4: New USB device found, idVendor=2233, idProduct=7001<br>[19238.711900] usb
1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0<br>[19238.711907] usb 1-1.4: Product: Generic HID<br>[19238.711912] usb 1-1.4: Manufacturer: Test<br>[19238.714576] generic-usb 0003:2233:7001.000F: hiddev0,hidraw3: USB HID v1.11 Device [Test Generic HID] on usb-0000:00:13.5-1.4/input0<br></div><div><br></div><div>I type "lsusb -v" and get.<br></div><div><br></div><div>Bus 001 Device 050: ID 2233:7001 RadioShack Corporation <br>Device Descriptor:<br> bLength 18<br> bDescriptorType 1<br> bcdUSB 2.00<br> bDeviceClass 0 (Defined at Interface level)<br> bDeviceSubClass 0 <br>
bDeviceProtocol 0 <br> bMaxPacketSize0 8<br> idVendor 0x2233 RadioShack Corporation<br> idProduct 0x7001 <br> bcdDevice 0.01<br> iManufacturer 1 Test<br> iProduct 2 Generic HID<br> iSerial 0 <br> bNumConfigurations 1<br> Configuration Descriptor:<br>
bLength 9<br> bDescriptorType 2<br> wTotalLength 41<br> bNumInterfaces 1<br> bConfigurationValue 1<br> iConfiguration 0 <br> bmAttributes 0xc0<br> Self Powered<br> MaxPower 100mA<br> Interface Descriptor:<br>
bLength 9<br> bDescriptorType 4<br> bInterfaceNumber 0<br> bAlternateSetting 0<br> bNumEndpoints 2<br> bInterfaceClass 3 Human Interface Device<br> bInterfaceSubClass 0 No Subclass<br> bInterfaceProtocol 0 None<br> iInterface 0
<br> HID Device Descriptor:<br> bLength 9<br> bDescriptorType 33<br> bcdHID 1.11<br> bCountryCode 0 Not supported<br> bNumDescriptors 1<br> bDescriptorType 34 Report<br>
wDescriptorLength 47<br> Report Descriptor: (length is 47)<br> Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440<br> (null)<br> Item(Local ): Usage, data= [ 0x01 ] 1<br> (null)<br> Item(Main ): Collection, data= [ 0x01 ]
1<br> Application<br> Item(Local ): Usage, data= [ 0x03 ] 3<br> (null)<br> Item(Global): Logical Minimum, data= [ 0x00 ] 0<br> Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255<br> Item(Global): Report Size, data= [ 0x08 ] 8<br> Item(Global): Report Count, data= [ 0x02 ]
2<br> Item(Main ): Input, data= [ 0x02 ] 2<br> Data Variable Absolute No_Wrap Linear<br> Preferred_State No_Null_Position Non_Volatile Bitfield<br> Item(Local ): Usage, data= [ 0x04 ] 4<br> (null)<br> Item(Global): Logical Minimum, data= [ 0x00 ]
0<br> Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255<br> Item(Global): Report Size, data= [ 0x08 ] 8<br> Item(Global): Report Count, data= [ 0x02 ] 2<br> Item(Main ): Output, data= [ 0x02 ] 2<br> Data Variable Absolute No_Wrap Linear<br> Preferred_State No_Null_Position Non_Volatile Bitfield<br>
Item(Local ): Usage, data= [ 0x05 ] 5<br> (null)<br> Item(Global): Logical Minimum, data= [ 0x00 ] 0<br> Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255<br> Item(Global): Report Size, data= [ 0x08 ] 8<br> Item(Global): Report Count, data= [ 0x02 ] 2<br> Item(Main ): Feature, data= [ 0x02 ] 2<br>
Data Variable Absolute No_Wrap Linear<br> Preferred_State No_Null_Position Non_Volatile Bitfield<br> Item(Main ): End Collection, data=none<br> Endpoint Descriptor:<br> bLength 7<br> bDescriptorType 5<br> bEndpointAddress 0x81 EP 1 IN<br> bmAttributes
3<br> Transfer Type Interrupt<br> Synch Type None<br> Usage Type Data<br> wMaxPacketSize 0x0040 1x 64 bytes<br> bInterval 1<br> Endpoint Descriptor:<br> bLength
7<br> bDescriptorType 5<br> bEndpointAddress 0x01 EP 1 OUT<br> bmAttributes 3<br> Transfer Type Interrupt<br> Synch Type None<br> Usage Type Data<br> wMaxPacketSize 0x0040 1x 64 bytes<br>
bInterval 1<br>Device Status: 0x0000<br> (Bus Powered)<br><br></div><div><br></div><div><br></div><div>Now this I had hacked around on mphidflsh to see if I could track it down. <br></div><div>./mphidflash -v 2233 -p 7001 -e <br></div><div><br></div><div>Turned on debugging and added some extra check points and I added data into the default buffer and added a second buffer to make sure it read it to a clean buffer. As you see the only data that is read back is one byte into the second buffer.Writing of the initial buffer gave no errors.<br></div><div><br></div><div>USB HID device found<br>Sending:<br>31 32 33 34 35 36 37 38 : 39 30 61 62 63 64 65 66 67 68 69 6a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 <br><br>About To Write<br><br>Done
Write<br><br>About to read into empty buffer<br>Done reading<br>Received:<br>31 59 00 00 00 00 00 00 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 <br><br>./mphidflash Error: USB read error<br><br></div><div><br></div><div>Tracked the error down to this function in mphidflash. usb-linux.c<br></div><div><br></div><div> if(HID_RET_SUCCESS != hid_interrupt_read(hid,0x81,usbBuf2,64,0))</div><div><br></div><div>What would cause libhid to return error on reading while writing is fine?</div><div><br></div><div><br></div><div>Daniel Yount <br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div></div></div></body></html>