Giter Club home page Giter Club logo

golang-evdev's People

Contributors

gvalkov avatar kovetskiy avatar muesli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

golang-evdev's Issues

Keyboard : char

Hi,
I am catching keyboard strokes (device.Grab + device.ReadOne) but how can I translate key events to a final char with right casing ?
Thanks.

Is golang-evdev a alternative to my use-case ?

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

Concurrency support: detect closed file descriptors

In order to cancel an ongoing read, I assumed is was sufficient to close the underlying file-descriptor by calling dev.File.Close() - but the ReadOne function (and I suppose the normal Read also) hangs until a new message arrives on the input device (tested with evemu).

I don't really see any other way to abort a read in progress... I've looked briefly into the code but couldn't immediately see what would be wrong, it just seems to use normal Go i/o internally?

Tested with go version go1.11.2 linux/amd64 with evemu.

Cross-compilation to linux/arm fails from OS X host

$ GOOS=linux GOARCH=arm go get github.com/gvalkov/golang-evdev
# github.com/gvalkov/golang-evdev
../../gvalkov/golang-evdev/device.go:132:9: undefined: ioctl
../../gvalkov/golang-evdev/device.go:132:38: undefined: EVIOCGBIT
../../gvalkov/golang-evdev/device.go:142:4: undefined: ioctl
../../gvalkov/golang-evdev/device.go:142:33: undefined: EVIOCGBIT
../../gvalkov/golang-evdev/device.go:164:15: undefined: MAX_NAME_SIZE
../../gvalkov/golang-evdev/device.go:165:15: undefined: MAX_NAME_SIZE
../../gvalkov/golang-evdev/device.go:167:9: undefined: ioctl
../../gvalkov/golang-evdev/device.go:167:38: undefined: EVIOCGID
../../gvalkov/golang-evdev/device.go:172:2: undefined: ioctl
../../gvalkov/golang-evdev/device.go:304:26: undefined: MAX_NAME_SIZE
../../gvalkov/golang-evdev/device.go:172:2: too many errors

New Project Maintainer

Good day @gvalkov, marvelous work you and the other contributors have done to craft this project.

I have noticed that the README was updated recently in regards to a new project maintainer.

I am in the process of cultivating some newfound works that are going to utilize many elements of this golang-evdev project and I thought I may just look to take over the status of maintainer of the project so I can bring things a bit more up to date and get some of the needed changes into the repository.

Let me know you thoughts and if this may work for yourself and I would be happy to take this one on.

Cheers

Source directory's name, import path

  1. Go get installs source in $GOPATH/src/github.com/gvalkov/golang-evdev. It should install it in $GOPATH/src/github.com/gvalkov/evdev if package name in it is evdev.
  2. Import path of package evdev in bin/evtest.go is evdev. It should be github.com/gvalkov/evdev.

sudo go get github.com/gvalkov/golang-evdev doesn't work

sudo go get github.com/gvalkov/golang-evdev
# github.com/gvalkov/golang-evdev
/usr/lib/go/src/pkg/github.com/gvalkov/golang-evdev/device.go:122: undefined: EV_MAX
/usr/lib/go/src/pkg/github.com/gvalkov/golang-evdev/device.go:122: invalid array bound (EV_MAX + 1) / 8
/usr/lib/go/src/pkg/github.com/gvalkov/golang-evdev/device.go:123: undefined: KEY_MAX
/usr/lib/go/src/pkg/github.com/gvalkov/golang-evdev/device.go:123: invalid array bound (KEY_MAX + 1) / 8
/usr/lib/go/src/pkg/github.com/gvalkov/golang-evdev/device.go:126: undefined: EV_MAX
/usr/lib/go/src/pkg/github.com/gvalkov/golang-evdev/device.go:130: undefined: EV_MAX
/usr/lib/go/src/pkg/github.com/gvalkov/golang-evdev/device.go:134: undefined: KEY_MAX
/usr/lib/go/src/pkg/github.com/gvalkov/golang-evdev/device.go:135: undefined: KEY_MAX
/usr/lib/go/src/pkg/github.com/gvalkov/golang-evdev/device.go:137: undefined: ByEventType
/usr/lib/go/src/pkg/github.com/gvalkov/golang-evdev/device.go:143: undefined: EV
/usr/lib/go/src/pkg/github.com/gvalkov/golang-evdev/device.go:143: too many errors

Writing to device?

Would be awesome if this library supported writing to the devices :-)

Errors when building device capabilities

Hi,

When trying to build device capabilities map, errors are raised for some arguments. With the commits that handle errors, when trying to open a device, errors are always raised, so my device list becomes empty...

Can be related to #14 and #15 .

go get github.com/gvalkov/golang-evdev fails

When I run the command :

go get -v "github.com/gvalkov/golang-evdev"
github.com/gvalkov/golang-evdev (download)
github.com/gvalkov/golang-evdev

github.com/gvalkov/golang-evdev

../../../../../gvalkov/golang-evdev/cdefs.go:4:26: fatal error: linux/input.h: No such file or directory
#include <linux/input.h>
^
compilation terminated.

I run the command from a docker container :
FROM golang:1.11.0-alpine3.8 as builder
RUN apk add -U alpine-sdk git python
ENV GOARCH=arm64

I tried cross compiling:
GOARCH=arm64 go build -v
github.com/Max2Inc/IES-Services/golang-evdev-master

github.com/Max2Inc/IES-Services/golang-evdev-master

./device.go:132:9: undefined: ioctl
./device.go:132:38: undefined: EVIOCGBIT
./device.go:142:4: undefined: ioctl
./device.go:142:33: undefined: EVIOCGBIT
./device.go:164:15: undefined: MAX_NAME_SIZE
./device.go:165:15: undefined: MAX_NAME_SIZE
./device.go:167:9: undefined: ioctl
./device.go:167:38: undefined: EVIOCGID
./device.go:172:2: undefined: ioctl
./device.go:323:26: undefined: MAX_NAME_SIZE
./device.go:172:2: too many errors

with the following config
go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jerome/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/jerome/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/jerome/Documents/Go Examples/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build261697354=/tmp/go-build -gno-record-gcc-switches"

Can not open input device on Raspberry Pi 3B+ anymore

After b6f418b there was some change that broke the usage of golang-evdev on my Raspberry Pi 3B+ running balenaOS. (With resin/scratch containers built with balenalib/raspberrypi3-alpine-golang)

In the latest version of this package the input device list is empty
([]*evdev.InputDevice{}) and /dev/input/event0 doesn’t exist.

For now my workaround is to lock the version of this package to b6f418b but just wanted to give you a heads up.

(I’m using this package in combination with https://github.com/nathany/bobblehat on a RPi connected to a SenseHAT)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.