[libhid-discuss] simple output
    Ael Gain 
    ael.gain at free.fr
       
    Wed Feb 11 18:02:35 UTC 2009
    
    
  
Hi everyone!
I'm new to USB programming and i'm trying to use libhid to communicate with a PIC18F4550. 
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... :)
here is the code:
int main(){
int  PATH_OUT[2] = { 0xffa00001, 0xffa00004 };
char write_packet[2] = { 31, 54  };
ret = hid_init();
HIDInterfaceMatcher matcher = { 0x1234, 0x0001, NULL, NULL, 0 };
hid = hid_new_HIDInterface();
ret = hid_force_open(hid, 0, &matcher, 3);
ret = hid_set_output_report(hid, PATH_OUT, 2, write_packet, 2);
      if (ret != HID_RET_SUCCESS) {
        printf( "dead\n");
      }else{ printf("good!\n");}
return 0;
}
I'm wondering about my path, so, I paste you the return of lusb -vvv :
          Report Descriptor: (length is 47)
            Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440
                            (null)
            Item(Local ): Usage, data= [ 0x01 ] 1
                            (null)
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Local ): Usage, data= [ 0x03 ] 3
                            (null)
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0x00 0xff ] 65280
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x01 ] 1
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x04 ] 4
                            (null)
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0x00 0xff ] 65280
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x01 ] 1
            Item(Main  ): Output, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x05 ] 5
                            (null)
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0x00 0xff ] 65280
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x02 ] 2
            Item(Main  ): Feature, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
Is my path allright ? Do you see any (many? :-) ) things wrong in my code ? I'm a bit lost in HID programming...
Thank you very much,
cloud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20090211/7493c32d/attachment.htm 
    
    
More information about the libhid-discuss
mailing list