signal11 / hidapi

A Simple library for communicating with USB and Bluetooth HID devices on Linux, Mac, and Windows.
http://www.signal11.us/oss/hidapi/
Other
2.46k stars 901 forks source link

Unable to read()... #310

Open makary123 opened 7 years ago

makary123 commented 7 years ago

Hello, i have some problems with HID API aplication. I just want to READ RFID data from card with my RFID reader pluged in USB port. I changed the VID and PID of the device in handle field, but its not wirking like should be.

I get this error: http://imgur.com/a/aOofi

Aplication detect my device, but the features of aplication (read...) do not work. What could be the error and how to fix it?

Thanks for help!

SlySven commented 7 years ago

Ah ha - I have a couple of these devices (one which has the same S/N as yours as it happens!) and they behave as keyboard devices - not sure whether you actually need (or can use?) hidapi to access them, if I remember correctly, intercepting keyboard data is restricted/prohibited on some platforms (Windoze!)

This is not a problem for my usage (developing an Access Control system running on an Raspberry Pi - which will unlock my front door when it sees the right tag) as with a Linux OS I can use an ioctl call with the EVIOCGRAB value for a daemon program to seize exclusive control of the devices which prevents the keystrokes that they generate when a tag is scanned from being seen as normal keyboard data (which would otherwise become a login attempt if there is no local user logged in) by the rest of the kernel...