[libhid-discuss] Set values to PATHLEN, RECV_PACKET_LEN y PATH_OUT
David H. Guerrero
elcinturapartida at yahoo.es
Wed Sep 27 20:37:22 UTC 2006
Hello, I set up RECV_PACKET_LEN to 5 however I get:
TRACE: hid_reset_parser(): resetting the HID parser for USB device
001/002[0]...
TRACE: hid_get_input_report(): retrieving report from USB device
001/002[0]...
TRACE: hid_prepare_parse_path(): preparing search path of depth 2 for
parse
tree of USB device 001/002[0]...
TRACE: hid_prepare_parse_path(): search path prepared for parse tree
of USB
device 001/002[0].
NOTICE: hid_find_object(): found requested item.
WARNING: hid_get_input_report(): failed to retrieve report from USB
device
001/002[0].
hid_get_input_report failed with return code 20
TRACE: hid_close(): closing USB device 001/002[0]...
TRACE: hid_close(): closing handle of USB device 001/002[0]...
NOTICE: hid_close(): successfully closed USB device 001/002[0].
TRACE: hid_reset_parser(): resetting the HID parser for USB device
001/002[0]...
I think that return code 20 is HID_RET_FAIL_GET_REPORT (from hid.h)
My /var/log/message:
Sep 27 22:45:35 debian kernel: hub.c: new USB device 00:14.2-1,
assigned
address 4
Sep 27 22:45:36 debian kernel: input: USB HID v1.00 Mouse [Logitech] on
usb1:4.0
Sep 27 22:45:39 debian usb.agent[1264]: hid: already loaded
Sep 27 22:45:39 debian kernel: mice: PS/2 mouse device common for all
mice
Sep 27 22:45:39 debian usb.agent[1264]: mousedev: loaded
successfully
Sep 27 22:45:56 debian kernel: usb-uhci.c: interrupt, status 2, frame#
937
Sep 27 22:46:06 debian kernel: usb_control/bulk_msg: timeout
Am I doing something wrong? My source code is:
# diff read_mouse.c test_libhid.c
5,6d4
< #define PATHLEN 2
< #define RECV_PACKET_LEN 5
45c43
< HIDInterfaceMatcher matcher = { 0x046dr, 0xc20d, NULL, NULL, 0 };
---
> HIDInterfaceMatcher matcher = { 0x046d, 0xc001, NULL, NULL, 0 };
194,200d191
< int const PATH_OUT[PATHLEN] = { 0x00010001, 0x00010030 };
< char packet[RECV_PACKET_LEN];
< ret = hid_get_input_report(hid, PATH_OUT, PATHLEN, packet,
RECV_PACKET_LEN);
< if (ret != HID_RET_SUCCESS) {
< fprintf(stderr, "hid_get_input_report failed with return code
%d\n",
ret);
< }
<
Thank you very much.
David
--- Charles Lepple <clepple at ghz.cc> escribió:
> On Sep 19, 2006, at 7:32 AM, el cintura partida wrote:
>
> > Hello,
> >
> > I trying read a input mice. How get usage path, a buffer, and the
> > length of
> > the latter from lsusb? In function hid_get_input_report (include/
> > hid.h) I need
> > set values to PATHLEN, RECV_PACKET_LEN y PATH_OUT of usb device.
>
> If you run test_libhid on your device, you can call hid_dump_tree()
> to list the values for PATH_OUT (and PATHLEN is just the number of
> usage page/usage pairs in the "path").
>
> >
> > Item(Global): Usage Page, data= [ 0x09 ] 9
> > Buttons
> > Item(Local ): Usage Minimum, data= [ 0x01 ] 1
> > Button 1 (Primary)
> > Item(Local ): Usage Maximum, data= [ 0x03 ] 3
> > Button 3 (Tertiary)
> ...
> > Item(Global): Report Count, data= [ 0x03 ] 3
> > Item(Global): Report Size, data= [ 0x01 ] 1
>
> 3 bits for buttons
>
>
> > Item(Main ): Input, data= [ 0x02 ] 2
> > Data Variable Absolute No_Wrap Linear
> > Preferred_State No_Null_Position
> > Non_Volatile
> > Bitfield
> > Item(Global): Report Count, data= [ 0x01 ] 1
> > Item(Global): Report Size, data= [ 0x05 ] 5
> > Item(Main ): Input, data= [ 0x01 ] 1
> > Constant Array Absolute No_Wrap Linear
> > Preferred_State No_Null_Position
> > Non_Volatile
> > Bitfield
>
> 5 padding bits
>
> > Item(Global): Usage Page, data= [ 0x01 ] 1
> > Generic Desktop Controls
> > Item(Local ): Usage, data= [ 0x30 ] 48
> > Direction-X
> > Item(Local ): Usage, data= [ 0x31 ] 49
> > Direction-Y
> > Item(Local ): Usage, data= [ 0x38 ] 56
> > Wheel
> > Item(Global): Logical Minimum, data= [ 0x81 ] 129
> > Item(Global): Logical Maximum, data= [ 0x7f ] 127
> > Item(Global): Report Size, data= [ 0x08 ] 8
> > Item(Global): Report Count, data= [ 0x03 ] 3
> > Item(Main ): Input, data= [ 0x06 ] 6
> > Data Variable Relative No_Wrap Linear
> > Preferred_State No_Null_Position
> > Non_Volatile
> > Bitfield
>
> 3 * 8 bits of motion delta
>
> > Item(Main ): End Collection, data=none
> > Item(Local ): Usage, data= [ 0x3c ] 60
> > Motion Wakeup
> > Item(Global): Logical Minimum, data= [ 0x00 ] 0
> > Item(Global): Logical Maximum, data= [ 0x01 ] 1
> > Item(Global): Report Size, data= [ 0x01 ] 1
> > Item(Global): Report Count, data= [ 0x01 ] 1
> > Item(Main ): Feature, data= [ 0x22 ] 34
> > Data Variable Absolute No_Wrap Linear
> > No_Preferred_State No_Null_Position
> > Non_Volatile
> > Bitfield
> > Item(Global): Report Count, data= [ 0x07 ] 7
> > Item(Main ): Feature, data= [ 0x01 ] 1
> > Constant Array Absolute No_Wrap Linear
> > Preferred_State No_Null_Position
> > Non_Volatile
> > Bitfield
>
> 1 bit "motion wakeup" plus 7 padding bits
>
> so I'd try setting RECV_PACKET_LEN to 5.
>
> If you are only targeting Linux, you also might want to try the /dev/
> input interface.
>
> --
> Charles Lepple
> clepple at ghz.cc
>
>
>
> _______________________________________________
> libhid-discuss mailing list
> libhid-discuss at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/libhid-discuss
>
______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
More information about the libhid-discuss
mailing list