Hey Andreas,<br>Did you try using the path {0xffa00001,0xffa00002,0xffa10006}?<br>Thanks!<br><br><div class="gmail_quote">On Tue, Dec 21, 2010 at 7:30 AM, Andreas Holzhammer - GMX <span dir="ltr">&lt;<a href="mailto:andreas.holzhammer@gmx.de">andreas.holzhammer@gmx.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
<br>
I&#39;m trying to adapt a USB LCD driver (graphlcd, dm140gink) from using direct ioctls to a libhid based solution.<br>
<br>
Unfortunately I can&#39;t get the dm140gink to accept the data I send. The original driver can be found at <a href="http://developer.berlios.de/patch/download.php?id=2627" target="_blank">http://developer.berlios.de/patch/download.php?id=2627</a>.<br>

<br>
I&#39;ve modified test_libhid.c to access my LCD display, and get the following paths:<br>
<br>
device identification of HIDInterface 002/004[0]:<br>
  dev_handle:    0x09a50580<br>
  device:        0x09a4b178<br>
  location:      002/004<br>
  manufacturer:  DM-140GINK Demo<br>
  product:       DM-140GINK Demo<br>
  TRACE: hid_reset_parser(): resetting the HID parser for USB device 002/004[0]...<br>
  TRACE: hid_dump_tree(): iterating the parse tree for USB device 002/004[0]...<br>
parse tree of HIDInterface 002/004[0]:<br>
  path: 0xffa00001.0xffa00002.0xffa10003; type: 0x80<br>
  path: 0xffa00001.0xffa00002.0xffa10004; type: 0x80<br>
  path: 0xffa00001.0xffa00002.0x00000000; type: 0x80<br>
  path: 0xffa00001.0xffa00002.0x00000000; type: 0x80<br>
  path: 0xffa00001.0xffa00002.0x00000000; type: 0x80<br>
  path: 0xffa00001.0xffa00002.0x00000000; type: 0x80<br>
  path: 0xffa00001.0xffa00002.0x00000000; type: 0x80<br>
  path: 0xffa00001.0xffa00002.0x00000000; type: 0x80<br>
  path: 0xffa00001.0xffa00002.0xffa10005; type: 0x90<br>
  path: 0xffa00001.0xffa00002.0xffa10006; type: 0x90<br>
  path: 0xffa00001.0xffa00002.0x00000000; type: 0x90<br>
  path: 0xffa00001.0xffa00002.0x00000000; type: 0x90<br>
  path: 0xffa00001.0xffa00002.0x00000000; type: 0x90<br>
  path: 0xffa00001.0xffa00002.0x00000000; type: 0x90<br>
  path: 0xffa00001.0xffa00002.0x00000000; type: 0x90<br>
  path: 0xffa00001.0xffa00002.0x00000000; type: 0x90<br>
  TRACE: hid_reset_parser(): resetting the HID parser for USB device 002/004[0]...<br>
<br>
Then I added a first output command to test_libhid.c to send the the first initialisation command (taken from the above source, &quot;panelCmd&quot;) to the device:<br>
<br>
   unsigned char const PATHLEN = 3;<br>
   int const PATH_IN[] = { 0xffa00001, 0xffa00002, 0xffa10003 };<br>
   int const PATH_OUT[] = { 0xffa00001, 0xffa00002, 0xffa10005 };<br>
   unsigned char const SEND_PACKET_LEN = 8;<br>
   char const PACKET[]  = {0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00};<br>
   ret = hid_set_output_report(hid, PATH_OUT, PATHLEN, PACKET, SEND_PACKET_LEN);<br>
   if (ret != HID_RET_SUCCESS) {<br>
     fprintf(stderr, &quot;hid_set_output_report failed with return code %d\n&quot;, ret);<br>
   }<br>
<br>
But this command times out:<br>
<br>
  TRACE: hid_set_output_report(): looking up report ID...<br>
  TRACE: hid_prepare_parse_path(): preparing search path of depth 3 for parse tree of USB device 002/004[0]...<br>
  TRACE: hid_prepare_parse_path(): search path prepared for parse tree of USB device 002/004[0].<br>
 NOTICE: hid_find_object(): found requested item.<br>
  TRACE: hid_set_output_report(): sending report ID 0x00 (length: 8) to USB device 002/004[0]...<br>
WARNING: hid_set_output_report(): failed to send report to USB device 002/004[0]:error sending control message: Connection timed out.<br>
hid_set_output_report failed with return code 19<br>
  TRACE: hid_close(): closing USB device 002/004[0]...<br>
<br>
I&#39;ve also tried to only pass 0xffa10005 as PATH, as suggested in the original code (in the SendReport function).<br>
<br>
Not sure, but this might be related to the original drivers initialisation code, which I have no idea how to implement in libhid:<br>
    //******************************************************<br>
    // Initialize the internal report structures<br>
    //******************************************************<br>
    if(ioctl(fd, HIDIOCINITREPORT,0)&lt;0)<br>
<br>
Unfortunaltey I don&#39;t have any documentation on the DM140gink device, so I have to rely on the existing graphlcd source code (which doesn&#39;t provide access to some of the features of the LCD).<br>
<br>
Any help greatly appreciated.<br>
<br>
Thanks,<br>
<br>
Andreas<br>
<br>
_______________________________________________<br>
libhid-discuss mailing list<br>
<a href="mailto:libhid-discuss@lists.alioth.debian.org" target="_blank">libhid-discuss@lists.alioth.debian.org</a><br>
<a href="http://lists.alioth.debian.org/mailman/listinfo/libhid-discuss" target="_blank">http://lists.alioth.debian.org/mailman/listinfo/libhid-discuss</a><br>
<a href="http://libhid.alioth.debian.org/" target="_blank">http://libhid.alioth.debian.org/</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Shiva<br>