首页 > 解决方案 > The Python library easyhid doesn't need set udev rules, whereas similar libraries like usb4java for Java need them to work on Linux

问题描述

Recently I made a peculiar observation. I wrote a small python script to communicate with my keyboard using the easyhid library. Finding, opening and also sending data to the device works out of the box. With Java on the other hand, I was able to find the device, but opening the device was not possible (tested with usb4java and hid4java). After a while, I found out that I did forget to set an udev rule for that keyboard. After I added that rule, opening the device was also possible in Java.

Now the question is: Why does easyhid still work if the udev rule is not set? Both the Python and the Java program are started with the same user rights. I also found out, that both libraries use the same backbone (hidapi). Is there a simple explanation for that behavior? It boggles me, as the python script shouldn't have more rights than the java program.

标签: javapythonlinuxhidudev

解决方案


推荐阅读