You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
As the device can only output a pre-defined textsequence, like "send-signal.sh(enter)"
I have to use the cli as a separate step to start a shellscript, that is
sending a signal to my app (sudo pkill -USR1 MyApp). Then the app reacts to the signal by toggling its state.
Press USB-Button -> USB Device pastes text sequence to cli "send-signal.sh(enter)" -> cli execute shellscript -> Shellscript sends signal to software -> Software toggles state
As this is a quite complicated way to toggle the software status, and I was wondering if golang-evdev
is able to do the trick also, even without using the cli.
Press USB-Button -> golang-evdev -> Software toggles state
As its a headless device, it would be great if I don't have to use cli in future as I do currently....
Thanks and best regards
Alex
The text was updated successfully, but these errors were encountered:
I don't have this device, but I have a use case that could help you.
I have a barcode reader that is seen as a keyboard, but I don't want the "keyboard" behavior. So I intercept the keypress and catch the barcode read, so I can handle it myself.
In your case, I don't know how the device is seen by the system (probably a keyboard), so with this lib you can easily catch your keypress and do your own magic.
Here is an extract of the code I have :
devices, err:=evdev.ListInputDevices()
// find the good devicedevice:=devices[0]
// catch device eventsdevice.Grab()
for {
evt, err:=device.ReadOne()
switchevt.Type {
caseevdev.EV_KEY:
// handle the event
}
}
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi, As github does not allow to send any message to gvalkov, I try a issue to state my question to him
Its a question, if golang-evdev can be used in my use-case...
Currently I am using a USB-Device https://www.usbbutton.com/ to toggle the state of a software.
As the device can only output a pre-defined textsequence, like "send-signal.sh(enter)"
I have to use the cli as a separate step to start a shellscript, that is
sending a signal to my app (sudo pkill -USR1 MyApp). Then the app reacts to the signal by toggling its state.
Press USB-Button -> USB Device pastes text sequence to cli "send-signal.sh(enter)" -> cli execute shellscript -> Shellscript sends signal to software -> Software toggles state
As this is a quite complicated way to toggle the software status, and I was wondering if golang-evdev
is able to do the trick also, even without using the cli.
Press USB-Button -> golang-evdev -> Software toggles state
As its a headless device, it would be great if I don't have to use cli in future as I do currently....
Thanks and best regards
Alex
The text was updated successfully, but these errors were encountered: