[libhid-discuss] hid_set_feature_report()
Charles Lepple
clepple at ghz.cc
Tue Jan 15 23:57:50 UTC 2008
On Jan 15, 2008, at 10:34 AM, Felipe Augusto de Souza wrote:
> but for send message
> in C++:
> if(!(HidD_SetFeature)(g_hDevice, &OUTPUT_BUFFER, sizeof
> (OUTPUT_BUFFER))
> g_hDevice is the deviceHandle, OUTPUT_BUFFER is a pointer and the
> size of
> the message.
> in OUTPUT_BUFFER the first byte is the ReportID and always sets to
> zero (0).
>
> and I tried to write this:
> hid_set_feature_report(hid,path,'\0x2A\0x0C\0x00\0x00\0x43\0x05\0x0A
> \0x14\0x13\0x29\0x26\0x30\0xD7')
This doesn't seem to match the debug output which says it is sending
52 bytes.
In the descriptor dump, if you are looking to set a feature, you want
to look for type 0xb0 (0x80 is input and 0x90 is output).
You also want to make the string the same length as the descriptor
says it should be, which is 63 bytes (all of the entries ending in
0x00000000 are extra bytes on the end of the field without 0x00000000).
You can zero-pad strings in Python in the following manner:
import struct
hid_set_feature_report(hid, path, struct.pack('63s', buf))
--
Charles Lepple
More information about the libhid-discuss
mailing list