Shen Chuan | 20 Aug 17:07 2014

Question about hid_force_open failed

Hello, 

Just installed libhid in the opensuse platform and running a c program to communicate with the card reader

i | libhidapi-devel   | Development libraries and header files for hidapi                   | package
i | libhidapi-hidraw0 | Simple library for communicating with USB and Bluetooth HID devices | package
i | libhidapi-libusb0 | Simple library for communicating with USB and Bluetooth HID devices | package

But when I run it, it always give me 13 error code. Not sure what it means, is there somewhere I can debug it?

hid_force_open failed with return code 13

Thank you for your help

Regards

Shen
Attachment (magtek.c): text/x-csrc, 9 KiB
_______________________________________________
libhid-discuss mailing list
libhid-discuss <at> lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/libhid-discuss
http://libhid.alioth.debian.org/
Makoto Fujiwara | 10 Oct 02:37 2013
Picon

On DragonFlyBSD

Hi, I'm just subscribed to this list, thank you.

I'm packaging libhid on pkgsrc, Mainly-for-NetBSD-application-packing.
Pkgsrc also supports several operating systems, such that DragonFly BSD 
etc.

At packaging for DragonFly, I needed attached patch for libhid-0.2.16.

Just for your information, 
(Please ignore '== -> =' fix in file configure)

Thanks again,
---
Makoto Fujiwara, 
Chiba, Japan, Narita Airport and Disneyland prefecture.
----
$NetBSD$

(1)
ERROR: [check-portability.awk] => Found test ... == ...:
ERROR: [check-portability.awk] configure:               if test "$py_version" == "None"; then
(2)
Add DragonflyBSD

--- configure.orig	2007-04-26 09:25:25.000000000 +0900
+++ configure	2013-10-10 07:33:08.485190000 +0900
 <at>  <at>  -2757,7 +2757,7  <at>  <at>  _ACEOF
         { echo "$as_me:$LINENO: result: Linux" >&5
 echo "${ECHO_T}Linux" >&6; }
         ;;
-      *-freebsd*|*-openbsd*|*-netbsd*|*-k*bsd*-gnu)
+      *-freebsd*|*-openbsd*|*-netbsd*|*-k*bsd*-gnu|*-dragonfly*)

 cat >>confdefs.h <<\_ACEOF
 #define OS_BSD
 <at>  <at>  -22774,7 +22774,7  <at>  <at>  echo $ECHO_N "checking for Python librar
 		py_version=`$PYTHON -c "from distutils.sysconfig import *; \
 			from string import join; \
 			print join(get_config_vars('VERSION'))"`
-		if test "$py_version" == "None"; then
+		if test "$py_version" = "None"; then
 			if test -n "$PYTHON_VERSION"; then
 				py_version=$PYTHON_VERSION
 			else

$NetBSD$

lshid.c:32:87: error: parameter 'len' set but not used [-Werror=unused-but-set-parameter]

--- test/lshid.c.orig	2007-03-31 23:27:51.000000000 +0900
+++ test/lshid.c	2013-10-10 07:40:18.961805000 +0900
 <at>  <at>  -29,7 +29,7  <at>  <at>  char *hid_id[32]; /* FIXME: 32 devices M

 struct usb_dev_handle;

-bool device_iterator (struct usb_dev_handle const* usbdev, void* custom, unsigned int len)
+bool device_iterator (struct usb_dev_handle const* usbdev, void* custom __attribute((unused)),
unsigned int len __attribute((unused)))
 {
   bool ret = false;
   int i;
 <at>  <at>  -37,8 +37,10  <at>  <at>  bool device_iterator (struct usb_dev_han
   const struct usb_device *device = usb_device((struct usb_dev_handle *)usbdev);

   /* only here to prevent the unused warning */
+#if 0
   /* TODO remove */
   len = *((unsigned long*)custom);
+#endif

   /* Obtain the device's full path */
   //sprintf(current_dev_path, "%s/%s", usbdev->bus->dirname, usbdev->device->filename);

_______________________________________________
libhid-discuss mailing list
libhid-discuss <at> lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/libhid-discuss
http://libhid.alioth.debian.org/

Vlatko Kosturjak | 26 Aug 11:00 2012
Picon

libhid gcc Werror patch

Hello,


This is patch for libhid so gcc doesn't stop on error if Werror is used: 

Problem:
======
gcc -DHAVE_CONFIG_H -I. -I..   -DNDEBUG -I../include -I../hidparser -O2 -Wall -W -Werror -MT lshid.o -MD -MP -MF .deps/lshid.Tpo -c -o lshid.o lshid.c
lshid.c: In function <E2><80><98>device_iterator<E2><80><99>:
lshid.c:32:87: error: parameter <E2><80><98>len<E2><80><99> set but not used [-Werror=unused-but-set-parameter]
cc1: all warnings being treated as errors

Patch:
=====
--- lshid.c 2012-08-26 10:54:29.671277650 +0200
+++ lshid.c.mod 2012-08-26 10:54:18.007988938 +0200
<at> <at> -29,6 +29,9 <at> <at>
 
 struct usb_dev_handle;
 
+/* unused parameter - don't give error on that warning */
+#pragma GCC diagnostic push 
+#pragma GCC diagnostic ignored "-Wunused-parameter"
 bool device_iterator (struct usb_dev_handle const* usbdev, void* custom, unsigned int len)
 {
   bool ret = false;
<at> <at> -36,10 +39,6 <at> <at>
   char current_dev_path[10];
   const struct usb_device *device = usb_device((struct usb_dev_handle *)usbdev);
   
-  /* only here to prevent the unused warning */
-  /* TODO remove */
-  len = *((unsigned long*)custom);
   /* Obtain the device's full path */
   //sprintf(current_dev_path, "%s/%s", usbdev->bus->dirname, usbdev->device->filename);
   sprintf(current_dev_path, "%s/%s", device->bus->dirname, device->filename);
<at> <at> -72,6 +71,7 <at> <at>
   
   return ret;
 }
+#pragma GCC diagnostic pop
 
 int main(void)
 {

Hope it helps,
--
Vlatko Kosturjak, Kost               
_______________________________________________
libhid-discuss mailing list
libhid-discuss <at> lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/libhid-discuss
http://libhid.alioth.debian.org/
Florian Rittmeier | 25 Aug 12:27 2012
Picon

Compiling on Raspbian / Debian Wheezy

Hello,

I just wanted to share, that I had troubles compiling libhid 0.2.16 from 
the tarball on a RaspberryPi running Raspbian (Debian Wheezy).

The trouble was caused by a warning issued from compiling test/lshid.c 
during "make". The warning, which was treated as error, was caused by 
the parameter len which was detected as not beeing used. This seems to 
be known as there is some workaround in the device_iterator function in 
test/lshid.c which tries pretend that len is used.

I don`t know why this is a problem now and was not before. Perhaps the 
gcc is getting wiser. ;-) As a solution I added to following line right 
below the existing workaround:
if(len){}

The compiler accepted this, the warning does not get issued anymore and 
libhid was successfully build.

Regards,
Florian

Attachment (smime.p7s): application/pkcs7-signature, 6789 bytes
_______________________________________________
libhid-discuss mailing list
libhid-discuss <at> lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/libhid-discuss
http://libhid.alioth.debian.org/
Andy Gair | 6 Aug 20:51 2012

libhid examples

I am looking for some examples on how to use “libhid” on windows 7 64bit. I have the source compiled and running, looking for examples on how to read/write a usb device, for testing I am trying to read my joystick.

 

Thanks

 

 

 

Andy Gair

Engineering Development Leader

2448 Destiny Way

Odessa

Florida 33556 USA

(727) 375-2520 x 105

 

_______________________________________________
libhid-discuss mailing list
libhid-discuss <at> lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/libhid-discuss
http://libhid.alioth.debian.org/
Michael Sandford | 18 Jul 21:14 2012

Need help installing on Debian 6 (Squeeze)

Hi Folks,

I am trying to install libhid on debian 6 and running into some problems.

1.  Dependency on swig and libhid-dev not well outlined, but solved.
2.  Installs to /usr/local/lib/python2.6/site-packages which isn't on 
pythonpath, but also solved.
3.  When trying to use library, get one of two errors:

sandford <at> debian-test:~/item_entry/src$ python
Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import hid
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
ImportError: No module named hid
 >>>

So then I do this:
sandford <at> debian-test:~/item_entry/src$ export 
PYTHONPATH="$PYTHONPATH:/usr/local/lib/python2.6/site-packages/"
sandford <at> debian-test:~/item_entry/src$ python
Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import hid
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
ImportError: No module named hid
 >>> import libhid
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/local/lib/python2.6/site-packages/libhid/__init__.py", 
line 29, in <module>
     _hid = swig_import_helper()
   File "/usr/local/lib/python2.6/site-packages/libhid/__init__.py", 
line 25, in swig_import_helper
     _mod = imp.load_module('_hid', fp, pathname, description)
ImportError: libhid.so.0: cannot open shared object file: No such file 
or directory
 >>>

So then I do this:
sandford <at> debian-test:~/item_entry/src$ ls 
/usr/local/lib/python2.6/dist-packages/libhid/
_hid.a   hid.pyc  _hid.so.0      hidwrap.pyc  __init__.pyc
_hid.la  hid.pyo  _hid.so.0.0.0  hidwrap.pyo  __init__.pyo
hid.py   _hid.so  hidwrap.py     __init__.py
sandford <at> debian-test:~/item_entry/src$

Funnily enough, libhid.so.0 is not in that directory.  I am not really 
sure what is going wrong here but I could really use some help to get it 
installed at working.

Thanks,
Mike

_______________________________________________
libhid-discuss mailing list
libhid-discuss <at> lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/libhid-discuss
http://libhid.alioth.debian.org/

Robert Warner | 9 May 23:39 2012
Picon

Configuration issue on SuSE 11.3

Hi,

How do I solve this issue?

Thanks in advance

checking for Python library path... /usr/lib64/python2.7/config/libpython2.7.so
checking for Python site-packages path... /usr/lib/python2.7/site-packages
checking python extra libraries...  -lpthread -ldl  -lutil
checking python extra linking flags... -Xlinker -export-dynamic
checking consistency of all components of python development environment... no
configure: error:
  Could not link test program to Python. Maybe the main Python library has been
  installed in some non-standard library path. If so, pass it to configure,
  via the LDFLAGS environment variable.
  Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
  ============================================================================
   ERROR!
   You probably have to install the development version of the Python package
   for your distribution.  The exact name of this package varies among them.
  ============================================================================
          
linux-q5yw:/usr/src/libhid-0.2.16/libhid-svn #
_______________________________________________
libhid-discuss mailing list
libhid-discuss <at> lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/libhid-discuss
http://libhid.alioth.debian.org/
Nelson Lombado | 23 Apr 07:31 2012
Picon

New library for LUA: lualibhid

Hi,
I'm Nelson from Argentina. In these days I'm working around a library 
for access to libhid in native way from LUA (script language). In this 
moment I can write the lshid example in a LUA script. This library is 
part of a bigger proyect that is developing. I want to thank for share 
your work.
Best regards.
-
Nelson

_______________________________________________
libhid-discuss mailing list
libhid-discuss <at> lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/libhid-discuss
http://libhid.alioth.debian.org/

Daniel Yount | 14 Nov 11:46 2011
Picon

USB libhid is writing to PIC but errors out reading from it.

Using Linux 3.x kernel and debian 6.0 stable distro.

USB flash program 1.3
http://code.google.com/p/mphidflash/

libhid 0.2.16

I have installed a Generic HID bootloader  and a basic p18F2455 circuit setup for reading and writing USB data.
20mhz crystal no LEDs one jumper for bootloader mode and a switch for reset., nothing special. 

When I plug it in and use the "dmesg" commandline program I get.

[19195.480407] usb 1-1.2: reset full speed USB device number 6 using ehci_hcd
[19238.616399] usb 1-1.4: new full speed USB device number 50 using ehci_hcd
[19238.711891] usb 1-1.4: New USB device found, idVendor=2233, idProduct=7001
[19238.711900] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[19238.711907] usb 1-1.4: Product: Generic HID
[19238.711912] usb 1-1.4: Manufacturer: Test
[19238.714576] generic-usb 0003:2233:7001.000F: hiddev0,hidraw3: USB HID v1.11 Device [Test Generic HID] on usb-0000:00:13.5-1.4/input0

I type "lsusb -v" and get.

Bus 001 Device 050: ID 2233:7001 RadioShack Corporation
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x2233 RadioShack Corporation
  idProduct          0x7001
  bcdDevice            0.01
  iManufacturer           1 Test
  iProduct                2 Generic HID
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      47
          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= [ 0xff 0x00 ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x02 ] 2
            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= [ 0xff 0x00 ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x02 ] 2
            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= [ 0xff 0x00 ] 255
            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
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)



Now this I had hacked around on mphidflsh to see if I could track it down.
./mphidflash -v 2233 -p 7001 -e

Turned on debugging and added some extra check points and I added data into the default buffer and added a second buffer to make sure it read it to a clean buffer. As you see the only data that is read back is one byte into the second buffer.Writing of the initial buffer gave no errors.

USB HID device found
Sending:
31 32 33 34 35 36 37 38 : 39 30 61 62 63 64 65 66 67 68 69 6a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

About To Write

Done Write

About to read into empty buffer
Done reading
Received:
31 59 00 00 00 00 00 00 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

./mphidflash Error: USB read error


Tracked the error down to this function in mphidflash. usb-linux.c

    if(HID_RET_SUCCESS != hid_interrupt_read(hid,0x81,usbBuf2,64,0))

What would cause libhid to return error on reading while writing is fine?


Daniel Yount












_______________________________________________
libhid-discuss mailing list
libhid-discuss <at> lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/libhid-discuss
http://libhid.alioth.debian.org/
Picon

Invitation to connect on LinkedIn

LinkedIn

Vinnicyus Gracindo requested to add you as a connection on LinkedIn:

David,

I'd like to add you to my professional network on LinkedIn.

- Vinnicyus

 
View invitation from Vinnicyus Gracindo

 

WHY MIGHT CONNECTING WITH VINNICYUS GRACINDO BE A GOOD IDEA?

People Vinnicyus Gracindo knows can discover your profile

Connecting to Vinnicyus Gracindo will attract the attention of LinkedIn users. See who's been viewing your profile.

 

© 2011, LinkedIn Corporation

_______________________________________________
libhid-discuss mailing list
libhid-discuss <at> lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/libhid-discuss
http://libhid.alioth.debian.org/
JamesPK | 8 Sep 12:45 2011

libhid with python: help appreciated

Hi,

Apologies for what might be a basic libhid question.

I'm running Ubuntu, and using libhid via Python to communicate with a 
HID device (and have used 'lsusb' to glean all the details of the device).

I've started out with the example code here: 
http://anonscm.debian.org/viewvc/libhid/trunk/swig/test_libhid.py .I 
added  the vendor and product ID and the example code itself worked FINE.

I then added some code to the example. From the 'snooping' on the 
communication with the device under Windows it needs a control message 
with an initialisation string to initialise the device, which I thought 
would be:

INIT_SEQ='0x20 0x00 0x08 0x01 0x00 0x00 0x00 0x00'
ret = hid_interrupt_write(hid, 0, INIT_SEQ, 8)
  if ret != HID_RET_SUCCESS:
         log_error("hid_set_output_report", ret)

But when I added the above spinet to the example and run it I get:
(ALL messages fine up to here)
---------------------
NOTICE: hid_force_open(): successfully opened USB device 006/002[0].
   TRACE: hid_reset_parser(): resetting the HID parser for USB device 
006/002[0]...
   TRACE: hid_dump_tree(): iterating the parse tree for USB device 
006/002[0]...
   TRACE: hid_reset_parser(): resetting the HID parser for USB device 
006/002[0]...
   TRACE: hid_interrupt_write(): writing interrupt report to device 
006/002[0] ...
WARNING: hid_interrupt_write(): failed to perform interrupt write to 
device 006/002[0]: error submitting URB: No such file or directory
---------------------

Any ideas/pointers would be much appreciated.

Thanks

James

_______________________________________________
libhid-discuss mailing list
libhid-discuss <at> lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/libhid-discuss
http://libhid.alioth.debian.org/


Gmane