Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Windows10) CreateFileA fails for pen device #276

Closed
p-i- opened this issue May 14, 2016 · 2 comments
Closed

(Windows10) CreateFileA fails for pen device #276

p-i- opened this issue May 14, 2016 · 2 comments

Comments

@p-i-
Copy link

p-i- commented May 14, 2016

I've documented this fully on SO http://stackoverflow.com/questions/37213634/createfilea-fails-to-open-hid-device-in-windows

I'm linking it here as it contains research that may help someone else. Also, maybe someone can see a solution?

My pen device actually reports 2 separate devices when I enumerate: UsagePage=1, Usage=2 and UsagePage=13, Usage=2.

hidapi currently doesn't let you open one of these, it will simply open the first vid/pid match. So it might be an idea to allow a couple of extra optional parameters to give a finer grain control.

If I attempt to open the 1/2 path I get ERROR_ACCESS_DENIED
If I attempt to open the 13/2 path I get ERROR_SHARING_VIOLATION

1/2 is {Generic Desktop Page}/{Mouse} and I have learned that Windows forbids read/write access on Mouse/Keyboard as a security measure.
However, I can see no reason why the 13/2 i.e. {Digitizer}/{Pen} path fails. It seems to be suggesting some other process has opened this path with conflicting access/sharing permissions. I have read that Windows opens all HID devices upon detection, so maybe if there was some way to force it to close this device before opening it...

π

@signal11
Copy link
Owner

Each "device" that you see shows up as a separate device to HIDAPI. This is how the platform APIs work. Each USB Interface that reports itself as HID will show up as a "device" in HIDAPI. You can differentiate between them by using the data returned from hid_enumerate().

@signal11
Copy link
Owner

Closing from no response.

erikolofsson pushed a commit to Malterlib/hidapi that referenced this issue Jun 3, 2021
- use TAG+="uaccess" instead of overly broad MODE="0666" by default example
        as advised by Debian:
        https://lists.debian.org/debian-devel-announce/2016/11/msg00008.html
        Adding the uaccess tag to udev rules
        ------------------------------------
Packages containing udev rules that use GROUP="plugdev" should also add
 TAG+="uaccess" so that all users that are physically present can access
 the relevant devices, instead of just users in the plugdev group
 (GROUP="plugdev"). Some packages use MODE="666" to allow all users
 (including remote users) to access devices. For almost all devices it is
 probably more appropriate to switch from MODE="666" to GROUP="plugdev",
 MODE="660", TAG+="uaccess" so that remote users cannot access local
 devices. Check the wiki page for USB gadgets[13] for more hints.
 There is a lintian warning in progress[14] for these issues.
  -- Paul Wise & Petter Reinholdtsen
 [] https://wiki.debian.org/USB/GadgetSetup
 [] https://bugs.debian.org/841670

- remove documentation for Linux <2.6.24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants