Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Aug 2020 01:02:28 -0400
From:      Waitman Gobble <gobble.wa@gmail.com>
To:        FreeBSD <freebsd-questions@freebsd.org>
Subject:   Re: Question about evdev and joystick. devfs rules
Message-ID:  <CAFuo_fzqojOw=%2B%2BNEyqY-97X_wXhzky60r0GM=eDh-uc9HW1LA@mail.gmail.com>
In-Reply-To: <CAFuo_fz7HsRRqUcarCJd1tS-H4Ds0x0yhGg3kxhF1JWj7L31hw@mail.gmail.com>
References:  <CAFuo_fz7HsRRqUcarCJd1tS-H4Ds0x0yhGg3kxhF1JWj7L31hw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Aug 1, 2020 at 12:53 AM Waitman Gobble <gobble.wa@gmail.com> wrote:
>
> When I plug in a USB game pad / joystick and open fd, use
> libevev_new_from_fd I get access denied if I'm not root. I think we
> used to have to set devfs rules but not sure if we are supposed to set
> up access in /etc/devfs.rules for /dev/input/event* devices? Maybe I
> just give myself permission to all /dev/input/event*
>  ?
>
> however, It seems that the keyboard and mouse are connected to
> /dev/input/event* and I obviously already have permission to access
> those devices, so that part is a bit confusing to me.
>
>
> This device connected to /dev/input/event7 today.
>
> If I query as 'regular' user
>
> fd = open("/dev/input/event7", O_RDONLY | O_NONBLOCK);
> rc = libevdev_new_from_fd(fd, &dev);
>
> Error: Failed to init libevdev (Bad file descriptor)
>
>
> But as root, i can query device.
>
>
> Input device name: "Microsoft X-Box 360 pad"
> Input device ID: bus 0x3 vendor 0x45e product 0x28e
> Input device GUID 030000005e0400008e02000070010000
>
>
> 0 - Joystick has button: 0x130 - BTN_SOUTH
> 1 - Joystick has button: 0x131 - BTN_EAST
> 2 - Joystick has button: 0x133 - BTN_NORTH
> 3 - Joystick has button: 0x134 - BTN_WEST
> 4 - Joystick has button: 0x136 - BTN_TL
> 5 - Joystick has button: 0x137 - BTN_TR
> 6 - Joystick has button: 0x13a - BTN_SELECT
> 7 - Joystick has button: 0x13b - BTN_START
> 8 - Joystick has button: 0x13c - BTN_MODE
> 9 - Joystick has button: 0x13d - BTN_THUMBL
> 10 - Joystick has button: 0x13e - BTN_THUMBR
>
>
> Joystick has absolute axis: 0x00 - ABS_X
> Values = { 0, -32768, 32767, 16, 128 }
> Joystick has absolute axis: 0x01 - ABS_Y
> Values = { 0, -32768, 32767, 16, 128 }
> Joystick has absolute axis: 0x02 - ABS_Z
> Values = { 0, 0, 255, 0, 0 }
> Joystick has absolute axis: 0x03 - ABS_RX
> Values = { 0, -32768, 32767, 16, 128 }
> Joystick has absolute axis: 0x04 - ABS_RY
> Values = { 0, -32768, 32767, 16, 128 }
> Joystick has absolute axis: 0x05 - ABS_RZ
> Values = { 0, 0, 255, 0, 0 }
>
>
> Joystick has hat 0
> Values = { 0, -1, 1, 0, 0 }
>
> Hat 0 Axis 1 Value -1
> Hat 0 Axis 1 Value 0
> Hat 0 Axis 1 Value 1
> Hat 0 Axis 1 Value 0
> Hat 0 Axis 0 Value 1
> Hat 0 Axis 0 Value 0
> Hat 0 Axis 0 Value -1
> Hat 0 Axis 0 Value 0
> Button 0
> Button 0
> Button 1
> Button 1
> Button 3
> Button 3
> Button 2
> Button 2
>
>


OOPs, I checked. I suppose webcamd is taking it.

# ls -lh /dev/input/event7
crw-rw----  1 webcamd  webcamd   0xad Aug  1 00:13 /dev/input/event7

-- 
Waitman Gobble



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFuo_fzqojOw=%2B%2BNEyqY-97X_wXhzky60r0GM=eDh-uc9HW1LA>