<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16643" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi everyone!</FONT></DIV>
<DIV><FONT face=Arial size=2>I'm new to USB programming and i'm trying to use
libhid to communicate with a PIC18F4550. </FONT></DIV>
<DIV><FONT face=Arial size=2>I wrote these lines of code (almost the
same than in test_libhid :) ) in order to send a byte to my PIC but,
even if it produces no errors when i run it, it doesn't seems to work...
:)</FONT></DIV>
<DIV><FONT face=Arial size=2>here is the code:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>int main(){<BR>int PATH_OUT[2] = {
0xffa00001, 0xffa00004 };</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>char write_packet[2] = { 31, 54
};</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>ret = hid_init();</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>HIDInterfaceMatcher matcher = { 0x1234, 0x0001,
NULL, NULL, 0 };</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>hid = hid_new_HIDInterface();<BR><BR>ret =
hid_force_open(hid, 0, &matcher, 3);<BR><BR>ret = hid_set_output_report(hid,
PATH_OUT, 2, write_packet, 2);<BR> if (ret !=
HID_RET_SUCCESS) {<BR> printf(
"dead\n");<BR> }else{
printf("good!\n");}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>return 0;<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I'm wondering about my path, so, I paste you the
return of lusb -vvv :</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2> 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= [ 0x00 0xff ]
65280<BR>
Item(Global): Report Size, data= [ 0x08 ]
8<BR>
Item(Global): Report Count, data= [ 0x01 ]
1<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= [ 0x00 0xff ]
65280<BR>
Item(Global): Report Size, data= [ 0x08 ]
8<BR>
Item(Global): Report Count, data= [ 0x01 ]
1<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= [ 0x00 0xff ]
65280<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</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Is my path allright ? Do you see any (many? :-) )
things wrong in my code ? I'm a bit lost in HID programming...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thank you very much,</FONT></DIV>
<DIV><FONT face=Arial size=2>cloud</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BODY></HTML>