Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Oct 2020 19:39:44 +0000
From:      bugzilla-noreply@freebsd.org
To:        usb@FreeBSD.org
Subject:   [Bug 250724] USB gamepads are tagged as a mouse by udev
Message-ID:  <bug-250724-19105-BPO4Q4GZfe@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-250724-19105@https.bugs.freebsd.org/bugzilla/>
References:  <bug-250724-19105@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D250724

waitman@waitman.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |waitman@waitman.net

--- Comment #7 from waitman@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=3D0 md=3DHOST spd=3DFUL=
L (12Mbps)
pwr=3DON (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 SD=
L2
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 =3D 0;
fd =3D open("/dev/input/event10", O_RDONLY | O_NONBLOCK);
rc =3D libevdev_new_from_fd(fd, &dev);
for (i =3D 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

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-250724-19105-BPO4Q4GZfe>