# 8Bitdo Gamepad



## landauclassic (Sep 21, 2021)

Hello :

I am trying to configure a bluetooth gamepad on FreeBSD 13.0, specifically an 8Bitdo SF30, basically a clone of the classic SNES controller. I have not found any information regarding this gamepad in this forum.

I have configured , hcsecd and bthidd successfully, actually the controller is paired successfully as it would be in any other operating system. The led indicators on the device indicate that the device is functional at the connection level.

```
[root@galaxy ~]# hccontrol -n ubt0hci read_connection_list
Remote BD_ADDR Handle Type Mode Role Encrypt Pending Queue State
8BitdoSnes 72 ACL 0 MAST P2P 0 0 0 OPEN
[root@galaxy ~]#
```
However I don't see any uhid device in the operating system, as it happens when I connect it via USB cable directly to the system.

```
uhid0: <8Bitdo SF30 Pro Controller, rev 2.00/1.14, addr 4> on usbus1
```
Is there anything I am omitting in the configuration of the device via Bluetooth ? has anyone configured an 8Bitdo device before?

Regards


----------



## sidetone (Sep 22, 2021)

I've gotten an 8Bitdo Famicon/NES retro gamepad to work only with the usb cable in a previous FreeBSD. The Bluetooth part didn't work, but the device showed up in `dmesg` as a (nonworking) wireless device.

I don't remember details, but this worked with either joystick(4) or SDL with the USB cable. The joystick input driver and manpage comes with x11-drivers/xf86-input-joystick. Unfortunately, this driver made the gamepad function as a mouse on my desktop as well.


In FreeBSD 13.0, there's hgame(4), which depends on iichid(4) in base. iichid isn't enabled by default. This would be what to check out. You can get it to work with the usb cable; try that first. Bluetooth or wireless capability could take a lot of work, which I don't know the current status. It's hit or miss, if it's within reach of now. If it's compatible with Bluetooth v1.2 or v2, it might work.


----------



## sidetone (Jun 3, 2022)

*Wired USB connection*
The 8Bitdo controller works with the generic gamepad/joystick driver hgame(4). On FreeBSD 13.1, usbhid(3) must be enabled from /boot/loader.conf. On older FreeBSD versions, it may have used another driver or hgame may have been set from another usb architecture. Device permissions must be set for /dev/input/, and the gamepad works with x11/antimicro. More instructions: Thread howto-enabling-multimedia-keys-generic-gamepads-joysticks-for-desktop-usbhid.84464, see post #11. Its main topic is multimedia keys on keyboards, but relevancy on gamepads/joysticks was added to it.






For an alternate way of not using antimicro or another application, additional device permissions must be added to a custom file in /usr/local/etc/devd/. It can be called 8bitdo.conf or any other chosen name, to distinguish it from other hardware.

Plugging in my 8Bitdo shows in `dmesg`:

```
ugen0.5: <8Bitdo FC30 Pro 8Bitdo FC30 Pro> at usbus0
usbhid6 on uhub0
usbhid6: <8Bitdo FC30 Pro 8Bitdo FC30 Pro, class 0/0, rev 2.00/0.01, addr 7> on usbus0
hidbus6: <HID bus> on usbhid6
hgame0: <8Bitdo FC30 Pro 8Bitdo FC30 Pro Gamepad> on hidbus6
```

`kldstat`, shows that hgame(4) also loaded automatically:
`13    1 0xffffffff8197a000     21e8 hgame.ko`

`usbconfig shows:`
`ugen0.5: <8Bitdo FC30 Pro 8Bitdo FC30 Pro> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (480mA)`

`lsusb`, from sysutils/usbutils shows:
`Bus /dev/usb Device /dev/ugen0.5: ID 1002:900`
From here, it can be seen how ugen0.3 matches with  what was shown in dmesg(8).

x11-drivers/xf86-input-joystick with additional configuration has been able to make the gamepad behave like a desktop mouse.

Here's an image of my Nintendo Famicon style 8Bitdo FC30 gamepad:



Anything not specific to this brand or style of gamepad can be carried on in another thread about generic gamepads for hgame. If there's more information on this particular brand or style of gamepad, please add to this thread.


----------



## sidetone (Jun 4, 2022)

*Taking another look at Bluetooth dongle and connectivity*
My 8Bitdo controller has ability for Bluetooth, but it isn't connected this way on my USB machine, at least not yet. I'm trying a Bluetooth v3 dongle. Either the Bluetooth version of this dongle isn't fully supported, or there's a lack of configuration.

When this dongle is plugged in, ng_ubt(4) and other Bluetooth drivers automatically load. `kldstat`:

```
6    1 0xffffffff8192d000     4d00 ng_ubt.ko
 7    6 0xffffffff81932000     aac8 netgraph.ko
 8    2 0xffffffff8193d000     a238 ng_hci.ko
 9    4 0xffffffff81948000     25a8 ng_bluetooth.ko
10    1 0xffffffff8194b000     e250 ng_l2cap.ko
11    1 0xffffffff8195a000    1bee8 ng_btsocket.ko
12    1 0xffffffff81976000     39c0 ng_socket.ko
```
 
From attaching my Bluetooth USB dongle:

```
usb_alloc_device: set address 5 failed (USB_ERR_TIMEOUT, ignored)
ugen0.5: <vendor 0x0a12 product 0x0001> at usbus0
ubt0 on uhub0
ubt0: <vendor 0x0a12 product 0x0001, class 224/1, rev 2.00/52.76, addr 4> on usbus0
WARNING: attempt to domain_add(bluetooth) after domainfinalize()
WARNING: attempt to domain_add(netgraph) after domainfinalize()
hardware_error: ubt0hci - hardware error 0x37
```
And detaching it:

```
ubt0: ubt_bulk_read_callback:1119: bulk-in transfer failed: USB_ERR_IOERROR
ugen0.5: <vendor 0x0a12 product 0x0001> at usbus0 (disconnected)
ubt0: at uhub0, port 1, addr 4 (disconnected)
ubt0: detached
```
From the above dmesg(8) error messages, this Bluetooth dongle was meant to work with ng_ubt, but isn't fully supported.

`lsusb` shows:
`Bus /dev/usb Device /dev/ugen0.5: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)`

`usbconfig` for the same ugen number:
`ugen0.5: <vendor 0x0a12 product 0x0001> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)`


https://freebsdfoundation.org/freebsd-project/resources/networking-basics-wifi-and-bluetooth/ is a Howto on setting up Bluetooth. I cloned these instructions and adapted them for a gamepad to Thread howto-enabling-multimedia-keys-generic-gamepads-joysticks-for-desktop-usbhid.84464 post #14. My gamepad was identified by the Bluetooth driver and made a connection to it, however, my gamepad didn't show functionality.

For beyond v1.1, some v2, and certain audio Bluetooth dongles, there's lack of clarity on which ones work, and for which kinds of devices. Sound streaming has been described to work well, while there's a lack of successes with other devices.


----------

