You are not logged in.
Pages: 1
Thing is, I want to toggle the power of my mouse. I do this by writing "auto" or "on" in the power/control file associated to the device. All that is fine. Until now, I just used "/sys/bus/usb/devices/7-2/power/control" and it worked.
Of course, after a reboot the mouse in now under 5-2 (instead of 7-2) so it doesn't work anymore. I'm guessing this is the usual "random loading" of the kernel, similar to /dev/sd? which means I'm looking for the UUID equivalent, but for my mouse (an USB device, obviously).
I'm not really familiar with the /sys fs, so I'm not sure how it works/where to look. So far I found that I could use this: /sys/class/input/mouse0/../../../../power/control
It works, and I'm assuming that, having only one mouse, it should always be named mouse0 and that might always work, but I don't know for sure. Would that be right? And if not, where/how should I do, to find a reliable path to the power/control file for my USB mouse?
Thanks.
Last edited by jjacky (2013-03-23 13:02:17)
Offline
Do you want this reliable for your own use, or do you intend to distibute a tool that should work for anyone? If the former, it sounds like you've got it.
You could also explore /sys/devices/virtual/input/mice/*
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Offline
Oh, I was thinking (path)/mice/power/control - it seems like it would be for all mice, but I haven't tested it.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Offline
Pages: 1