Question about evdev and joystick. devfs rules
Waitman Gobble
gobble.wa at gmail.com
Sat Aug 1 04:54:11 UTC 2020
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
--
Waitman Gobble
More information about the freebsd-questions
mailing list