[Bug 250724] USB gamepads are tagged as a mouse by udev
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Thu Oct 29 19:39:45 UTC 2020
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250724
waitman at waitman.net changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |waitman at waitman.net
--- Comment #7 from waitman at waitman.net ---
I have used a joystick on FreeBSD. webcamd takes the device.
ugen0.5: <HJC Game GAME FOR WINDOWS> at usbus0
uhid2 on uhub1
uhid2: <HJC Game GAME FOR WINDOWS, rev 2.00/1.70, addr 6> on usbus0
uhid2: at uhub1, port 2, addr 6 (disconnected)
uhid2: detached
# usbinfo
ugen0.5: <HJC Game GAME FOR WINDOWS> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps)
pwr=ON (500mA)
# ls -l /dev/input/*
crw------- 1 root wheel 0xd Oct 29 15:06 /dev/input/event0
crw------- 1 root wheel 0x2a Oct 27 23:56 /dev/input/event1
crw-rw---- 1 webcamd webcamd 0xee Oct 29 14:52 /dev/input/event10
crw------- 1 root wheel 0x47 Oct 27 23:56 /dev/input/event2
crw------- 1 root wheel 0x48 Oct 29 15:06 /dev/input/event3
crw------- 1 root wheel 0x49 Oct 29 15:06 /dev/input/event4
crw------- 1 root wheel 0x4a Oct 29 15:06 /dev/input/event5
crw------- 1 root wheel 0x4f Oct 27 23:56 /dev/input/event6
crw------- 1 root wheel 0xa3 Oct 29 15:06 /dev/input/event7
crw------- 1 root wheel 0xf9 Oct 29 15:06 /dev/input/event8
crw------- 1 root wheel 0x8e Oct 27 23:56 /dev/input/event9
crw-rw---- 1 webcamd webcamd 0xf0 Oct 29 14:52 /dev/input/js0
you can set up rules to give your regular used access, or I think it's just as
easy to add your user to the webcamd group.
so, you can read the device. a game engine that works on FreeBSD such as SDL2
has the code to read it.
Here's a simple example: using libevdev.h.
(defines in /usr/local/include/linux/input-event-codes.h)
int nbuttons = 0;
fd = open("/dev/input/event10", O_RDONLY | O_NONBLOCK);
rc = libevdev_new_from_fd(fd, &dev);
for (i = BTN_JOYSTICK; i < KEY_MAX; ++i) {
if (libevdev_has_event_code(dev, EV_KEY, i)) {
printf("%d - Joystick has button: 0x%x - %s\n", nbuttons, i,
libevdev_event_code_get_name(EV_KEY, i));
++nbuttons;
}
}
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
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-usb
mailing list