Date: Tue, 10 Feb 2004 16:03:10 -0800 (PST) From: Maksim Yevmenkin <m_evmenkin@yahoo.com> To: hackers@freebsd.org, current@freebsd.org Cc: imp@freebsd.org Subject: [PATCH] libusbhid(3) Message-ID: <20040211000310.60099.qmail@web40303.mail.yahoo.com>
next in thread | raw e-mail | index | archive | help
--0-1120976778-1076457790=:59133 Content-Type: text/plain; charset=us-ascii Content-Id: Content-Disposition: inline Dear Hackers, does anyone objects to the attached libusbhid(3) patch? unpatched library gives me wrong HID page/usage values when i try to parse HID descriptor from Microsoft Bluetooth keyboard. please see attached patched.txt and unpatched.txt outputs. thanks, max __________________________________ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html --0-1120976778-1076457790=:59133 Content-Type: text/plain; name="libusbhid.patch.txt" Content-Description: libusbhid.patch.txt Content-Disposition: inline; filename="libusbhid.patch.txt" Index: parse.c =================================================================== RCS file: /home/ncvs/src/lib/libusbhid/parse.c,v retrieving revision 1.9 diff -u -r1.9 parse.c --- parse.c 28 Jan 2004 00:05:22 -0000 1.9 +++ parse.c 10 Feb 2004 23:51:27 -0000 @@ -213,12 +213,11 @@ dval = 0; break; case 1: - dval = (int8_t)*data++; + dval = *data++; break; case 2: dval = *data++; dval |= *data++ << 8; - dval = (int16_t)dval; break; case 4: dval = *data++; Index: usbhid.h =================================================================== RCS file: /home/ncvs/src/lib/libusbhid/usbhid.h,v retrieving revision 1.9 diff -u -r1.9 usbhid.h --- usbhid.h 9 Apr 2003 01:52:48 -0000 1.9 +++ usbhid.h 10 Feb 2004 23:51:27 -0000 @@ -45,7 +45,7 @@ typedef struct hid_item { /* Global */ - int _usage_page; + unsigned int _usage_page; int logical_minimum; int logical_maximum; int physical_minimum; --0-1120976778-1076457790=:59133 Content-Type: text/plain; name="patched.txt" Content-Description: patched.txt Content-Disposition: inline; filename="patched.txt" Collection page=Generic_Desktop usage=Keyboard Output id=1 size=1 count=1 page=LEDs usage=Num_Lock Variable, logical range 0..1 Output id=1 size=1 count=1 page=LEDs usage=Caps_Lock Variable, logical range 0..1 Output id=1 size=1 count=1 page=LEDs usage=Scroll_Lock Variable, logical range 0..1 Output id=1 size=1 count=1 page=LEDs usage=Generic_Indicator Variable, logical range 0..1 Output id=1 size=1 count=4 page=0x0000 usage=0x0000 Const, logical range 0..1 Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_LeftControl Variable, logical range 0..1 Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_LeftShift Variable, logical range 0..1 Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_LeftAlt Variable, logical range 0..1 Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_Left_GUI Variable, logical range 0..1 Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_RightControl Variable, logical range 0..1 Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_RightShift Variable, logical range 0..1 Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_RightAlt Variable, logical range 0..1 Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_Right_GUI Variable, logical range 0..1 Input id=1 size=8 count=1 page=0x0000 usage=0x0000 Const, logical range 0..1 Input id=1 size=8 count=6 page=Keyboard usage=Reserved_(no_event_indicated), logical range 0..255 End collection Collection page=Consumer usage=Consumer_Control Input id=2 size=1 count=1 page=Consumer usage=Mute Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=Stop Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=0x00cd Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=Volume_Down Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=Volume_Up Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=Scan_Previous_Track Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=Scan_Next_Track Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AL_Consumer_Control_Configuration Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AC_Undo Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=0x0279 Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=0x01ab Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AC_Print Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AC_Open Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AC_Close Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AC_Save Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AC_New Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AL_Calculator Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AL_Logoff Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=Help Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AC_Home Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=0x0289 Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=0x028b Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=0x028c Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AL_Email_Reader Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AL_Network_Chat Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=0x01a7 Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=0x01b6 Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=0x01b7 Variable, logical range 0..1 Input id=2 size=1 count=4 page=0x0000 usage=0x0000 Const, logical range 0..1 Input id=2 size=8 count=1 page=Microsoft usage=0xff02 Variable, logical range 0..255 End collection Collection page=Generic_Desktop usage=System_Control Input id=3 size=1 count=1 page=Generic_Desktop usage=System_Power_Down Variable, logical range 0..1 Input id=3 size=1 count=1 page=Generic_Desktop usage=System_Sleep Variable, logical range 0..1 Input id=3 size=1 count=1 page=Generic_Desktop usage=System_Wake_Up Variable, logical range 0..1 Input id=3 size=1 count=5 page=0x0000 usage=0x0000 Const, logical range 0..1 End collection Collection page=Consumer usage=Consumer_Control Collection page=Generic_Desktop usage=Keyboard Input id=4 size=2 count=1 page=Microsoft usage=0xfe01 Variable, logical range 0..3 Input id=4 size=6 count=1 page=0x0000 usage=0x0000 Const, logical range 0..3 End collection End collection Collection page=Consumer usage=Consumer_Control Collection page=Generic_Desktop usage=Keyboard Input id=5 size=1 count=1 page=Microsoft usage=0xfe03 Variable, logical range 0..1 Input id=5 size=1 count=1 page=Microsoft usage=0xfe04 Variable, logical range 0..1 Input id=5 size=1 count=6 page=0x0000 usage=0x0000 Const, logical range 0..1 End collection End collection Collection page=Consumer usage=Consumer_Control Input id=255 size=2 count=1 page=0x0006 usage=0x0024 Variable, logical range 0..1 Input id=255 size=6 count=1 page=0x0000 usage=0x0000 Const, logical range 0..1 End collection --0-1120976778-1076457790=:59133 Content-Type: text/plain; name="unpatched.txt" Content-Description: unpatched.txt Content-Disposition: inline; filename="unpatched.txt" Collection page=Generic_Desktop usage=Keyboard Output id=1 size=1 count=1 page=LEDs usage=Num_Lock Variable, logical range 0..1 Output id=1 size=1 count=1 page=LEDs usage=Caps_Lock Variable, logical range 0..1 Output id=1 size=1 count=1 page=LEDs usage=Scroll_Lock Variable, logical range 0..1 Output id=1 size=1 count=1 page=LEDs usage=Generic_Indicator Variable, logical range 0..1 Output id=1 size=1 count=4 page=0x0000 usage=0x0000 Const, logical range 0..1 Input id=1 size=1 count=1 page=0xffff usage=0xffe0 Variable, logical range 0..1 Input id=1 size=1 count=1 page=0xffff usage=0xffe1 Variable, logical range 0..1 Input id=1 size=1 count=1 page=0xffff usage=0xffe2 Variable, logical range 0..1 Input id=1 size=1 count=1 page=0xffff usage=0xffe3 Variable, logical range 0..1 Input id=1 size=1 count=1 page=0xffff usage=0xffe4 Variable, logical range 0..1 Input id=1 size=1 count=1 page=0xffff usage=0xffe5 Variable, logical range 0..1 Input id=1 size=1 count=1 page=0xffff usage=0xffe6 Variable, logical range 0..1 Input id=1 size=1 count=1 page=0xffff usage=0xffe7 Variable, logical range 0..1 Input id=1 size=8 count=1 page=0x0000 usage=0x0000 Const, logical range 0..1 Input id=1 size=8 count=6 page=Keyboard usage=Reserved_(no_event_indicated), logical range 0..255 End collection Collection page=Consumer usage=Consumer_Control Input id=2 size=1 count=1 page=0xffff usage=0xffe2 Variable, logical range 0..1 Input id=2 size=1 count=1 page=0xffff usage=0xffb7 Variable, logical range 0..1 Input id=2 size=1 count=1 page=0xffff usage=0xffcd Variable, logical range 0..1 Input id=2 size=1 count=1 page=0xffff usage=0xffea Variable, logical range 0..1 Input id=2 size=1 count=1 page=0xffff usage=0xffe9 Variable, logical range 0..1 Input id=2 size=1 count=1 page=0xffff usage=0xffb6 Variable, logical range 0..1 Input id=2 size=1 count=1 page=0xffff usage=0xffb5 Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AL_Consumer_Control_Configuration Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AC_Undo Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=0x0279 Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=0x01ab Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AC_Print Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AC_Open Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AC_Close Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AC_Save Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AC_New Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AL_Calculator Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AL_Logoff Variable, logical range 0..1 Input id=2 size=1 count=1 page=0xffff usage=0xff95 Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AC_Home Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=0x0289 Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=0x028b Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=0x028c Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AL_Email_Reader Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=AL_Network_Chat Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=0x01a7 Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=0x01b6 Variable, logical range 0..1 Input id=2 size=1 count=1 page=Consumer usage=0x01b7 Variable, logical range 0..1 Input id=2 size=1 count=4 page=0x0000 usage=0x0000 Const, logical range 0..1 Input id=2 size=8 count=1 page=0xffff usage=0xff02 Variable, logical range 0..255 End collection Collection page=0xffff usage=0xff80 Input id=3 size=1 count=1 page=0xffff usage=0xff81 Variable, logical range 0..1 Input id=3 size=1 count=1 page=0xffff usage=0xff82 Variable, logical range 0..1 Input id=3 size=1 count=1 page=0xffff usage=0xff83 Variable, logical range 0..1 Input id=3 size=1 count=5 page=0x0000 usage=0x0000 Const, logical range 0..1 End collection Collection page=Consumer usage=Consumer_Control Collection page=Generic_Desktop usage=Keyboard Input id=4 size=2 count=1 page=0xffff usage=0xfe01 Variable, logical range 0..3 Input id=4 size=6 count=1 page=0x0000 usage=0x0000 Const, logical range 0..3 End collection End collection Collection page=Consumer usage=Consumer_Control Collection page=Generic_Desktop usage=Keyboard Input id=5 size=1 count=1 page=0xffff usage=0xfe03 Variable, logical range 0..1 Input id=5 size=1 count=1 page=0xffff usage=0xfe04 Variable, logical range 0..1 Input id=5 size=1 count=6 page=0x0000 usage=0x0000 Const, logical range 0..1 End collection End collection Collection page=Consumer usage=Consumer_Control Input id=255 size=2 count=1 page=0x0006 usage=0x0024 Variable, logical range 0..1 Input id=255 size=6 count=1 page=0x0000 usage=0x0000 Const, logical range 0..1 End collection --0-1120976778-1076457790=:59133--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040211000310.60099.qmail>