I' ve tested my device with Libusb, and Usbview, both I received wMaxPacketSize = 8. How hid-core get this informations? I believe it is by /proc/bus/usb devices file, which has inside:
T: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2 B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0 D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P: Vendor=0000 ProdID=0000 Rev= 0.00 S: Product=USB UHCI Root Hub S: SerialNumber=1820 C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms T: Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=1.5 MxCh= 0 D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P: Vendor=0e40 ProdID=0001 Rev= 0.01 S: Manufacturer=PROTEQ ltda C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=hid E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=10ms T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2 B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0 D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P: Vendor=0000 ProdID=0000 Rev= 0.00 S: Product=USB UHCI Root Hub S: SerialNumber=1800 C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms
MY CODE.
int WriteReport() { int i,ret,j; signed char OUTUSA[10]; struct hiddev_usage_ref uref; struct hiddev_report_info rinfo; struct hiddev_field_info finfo; if(ioctl(fd,HIDIOCINITREPORT,0)<0) return(-1); rinfo.report_type = HID_REPORT_TYPE_OUTPUT; rinfo.report_id = HID_REPORT_ID_FIRST ; if(ioctl( fd, HIDIOCGREPORTINFO, &rinfo)<0) return(-1); finfo.report_type = rinfo.report_type; finfo.report_id = rinfo.report_id; finfo.field_index = 0; if(ioctl(fd, HIDIOCGFIELDINFO, &finfo)<0)return(-1); printf("max use write =%d",(int)finfo.maxusage);
for (i=0;i<(int)finfo.maxusage;i++){ uref.report_type = finfo.report_type; uref.report_id = finfo.report_id; uref.field_index = 0; uref.usage_index = i; OUTUSA[0]=(signed char)OutputReport[i+1]; uref.value=OUTUSA[0]; if(ioctl(fd,HIDIOCSUSAGE,&uref) <0) return(-2); } rinfo.report_type=HID_REPORT_TYPE_OUTPUT; rinfo.report_id=HID_REPORT_ID_FIRST; rinfo.num_fields=1; if(ioctl(fd,HIDIOCSREPORT,&rinfo)<0)return(-2); usleep(30000); return(0); }
Fernando Amaury System/Hardware Engineer
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel