Discussion:
[libhid-discuss] Question about hid_force_open failed
Shen Chuan
2014-08-20 15:07:44 UTC
Permalink
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20140820/2d0ff1d1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: magtek.c
Type: text/x-csrc
Size: 7218 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20140820/2d0ff1d1/attachment.c>
Charles Lepple
2014-08-20 23:56:41 UTC
Permalink
Post by Shen Chuan
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?
You could try running it under strace to see the return values from the system calls. If the 13 is coming from a system call, strace will show the symbolic error name.
Post by Shen Chuan
hid_force_open failed with return code 13
There are at least three separate HID APIs for Linux:

1) http://libhid.alioth.debian.org/ (defunct; uses this list)
2) the Linux kernel HID API, sometimes called hidraw
3) http://www.signal11.us/oss/hidapi/ (also https://github.com/signal11/hidapi) which corresponds to those packages

I am not too familiar with #2 and #3. If it is #3, you should be able to look up that error code in their Doxygen output: http://www.signal11.us/oss/hidapi/hidapi/doxygen/html/group__API.html

If it is #2, error 13 is EACCESS, so you might want to check permissions on /dev/bus/usb. HIDAPI might also be passing that error code through to you from the kernel HID API.
--
Charles Lepple
clepple at gmail



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20140820/fe18864a/attachment.html>
Shen Chuan
2014-08-27 14:49:49 UTC
Permalink
Hello Charles,

Sorry for the late reply. Last week we were debating if we want to add this
libhid communication device software into our build. We were trying to
communicate with the cardreader. But looks like the communication c code
provided for magtek reader is not working consistently among different
models of our PCs. We had Lenovo m71e and this model always works without
-13 issue but not the other models. When I was trying to debug with strace
and management decided not to spend more time on it and the strace is not
available in our PCs in suse platform so I stopped from there.

I attacked the c program and libhid rpm we experimented in the attachment.
Sorry genuinely want to contribute more to the society.

And thank you for your help with the NUT ups, we were using EATON 3S and
Tripplite. The ups software performs very well in the field.

Thank you again

Shen
Post by Shen Chuan
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?
You could try running it under strace to see the return values from the
system calls. If the 13 is coming from a system call, strace will show the
symbolic error name.
hid_force_open failed with return code 13
1) http://libhid.alioth.debian.org/ (defunct; uses this list)
2) the Linux kernel HID API, sometimes called hidraw
3) http://www.signal11.us/oss/hidapi/ (also
https://github.com/signal11/hidapi) which corresponds to those packages
I am not too familiar with #2 and #3. If it is #3, you should be able to
http://www.signal11.us/oss/hidapi/hidapi/doxygen/html/group__API.html
If it is #2, error 13 is EACCESS, so you might want to check permissions
on /dev/bus/usb. HIDAPI might also be passing that error code through to
you from the kernel HID API.
--
Charles Lepple
clepple at gmail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20140827/fffd69c5/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libhid-0.2.17-12.fc18.x86_64.rpm
Type: application/x-rpm
Size: 31308 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20140827/fffd69c5/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: magtek-tool.zip
Type: application/zip
Size: 15788 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20140827/fffd69c5/attachment-0001.zip>
Loading...