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

--watch not working #44

Open
wkwkw opened this issue Mar 27, 2019 · 5 comments
Open

--watch not working #44

wkwkw opened this issue Mar 27, 2019 · 5 comments

Comments

@wkwkw
Copy link
Contributor

wkwkw commented Mar 27, 2019

I tried running xkeysnail with --watch and plugged in a keyboard, but nothing happened.

After some easy debugging, I found that at plugging in a keyboard, add_new_devices() is called properly and getting event.name is ok, but no code after new_device = InputDevice("/dev/input/" + event.name) is not working.

My environment is as below.
Ubuntu: 16.0.4
xkeysnail: 0.1.0
python: 3.6.4
pip: 19.0.3

Thanks.

@wkwkw
Copy link
Contributor Author

wkwkw commented Apr 18, 2019

I found that it happens only when I'm running xkeysnail as another user.
The problem seems to be that the user has no permission to access /dev/input/*.

@kentacho
Copy link

kentacho commented May 1, 2019

I had a similar permission issue. In my case, the problem is that when a keyboard is plugged and the device file is created in /dev/input, xkeysnail tries to access the device file before the correct permission is set.

My problem was solved by changing this line:

        inotify.add_watch("/dev/input", flags.CREATE)

to

        inotify.add_watch("/dev/input", flags.CREATE | flags.ATTRIB)

(So xkeysnail retries to access the device file when the permission is changed.)
Does this fix your issue as well?

@wkwkw
Copy link
Contributor Author

wkwkw commented Jun 27, 2019

@kentacho
Your solution worked fine for my issue. Thank you very much!

wkwkw added a commit to wkwkw/xkeysnail that referenced this issue Jun 27, 2019
Added ATTRIB flag to inotify so that it can watch permission change of device.
It can solve the problem of failing to reconnect to device when xkeysnail tries to access the device before the proper permission is set.

See the comment of @kentacho in issue mooz#44
wkwkw added a commit to wkwkw/xkeysnail that referenced this issue Jun 27, 2019
Added ATTRIB flag to inotify so that it can watch permission change of device.
It can solve the problem of failing to reconnect to device when xkeysnail tries to access the device before the proper permission is set.

See the comment of @kentacho in issue mooz#44
@joshgoebel
Copy link

@wkwkw Think we can close this issue now?

@joshgoebel
Copy link

Ping.

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

3 participants