Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: uutzinger on April 16, 2023, 02:10:51 AM
-
I would like to use bluetooth gamepad Umido ESoul DH2 to control a motor project.
On raspian I can connect to to the gamepad using the desktop bluetooth manager. It creates a mouse device and I can move the mouse cursor with the gamepad.
On piCore I can pair, trust and obtain information from the gamepad but a connection attempt fails. It appears the rules to create a bluetooth mouse and keyboard are missing.
Do I simply need to copy the udev rules from the Raspian system to the piCore system?
I followed this thread to create the bluetooth connection on piCore.
http://forum.tinycorelinux.net/index.php/topic,26117.msg167671.html#msg167671
-
You could try using the blueman extension to pair once you have started bluez.
-
I followed this thread to create the bluetooth connection on piCore.
http://forum.tinycorelinux.net/index.php/topic,26117.msg167671.html#msg167671
I have had a Playstation 4 controller connected, it needs the joydev module loaded with "sudo modprobe joydev". I haven't had it working as a mouse though, that might require an extra step.
Here's my connection script for a bluetooth controller (run after bluetooth is initialised with the script I posted at the link), although I'm not sure how well I've tested it:
#!/bin/ash
# Connect to bluetooth device with mac or ID listed in file
# Run as root.
if [ -s "/home/tc/btdev_controller.txt" ]
then
modprobe joydev
echo Searching for bluetooth controllers...
dev=
while [ -z "$dev" ]
do
sleep 1
dev="`bluetoothctl devices | grep -f /mnt/mmcblk0p1/btdev_controller.txt`"
done
mac=`expr "$dev" : 'Device \(..:..:..:..:..:..\) '`
bluetoothctl pair $mac
bluetoothctl connect $mac
fi
-
Oops, I left in the wrong path to btdev_controller.txt in the grep command.
if [ -s "/home/tc/btdev_controller.txt" ]
then
modprobe joydev
echo Searching for bluetooth controllers...
dev=
while [ -z "$dev" ]
do
sleep 1
dev="`bluetoothctl devices | grep -f /home/tc/btdev_controller.txt`"
done
mac=`expr "$dev" : 'Device \(..:..:..:..:..:..\) '`
bluetoothctl pair $mac
bluetoothctl connect $mac
fi
Also it looks like I probably added the joydev module out of:
http://tinycorelinux.net/13.x/armv6/releases/RPi/src/kernel/5.10.77-piCore_modules.tar.xz
So you'll have to do that first (you can copy the joydev.ko file over and then add it to /opt/.filetool.lst). Copy from the _modules.tar.xz file that matches the PiCore build that you're using (armv6, PiCore 13.1, in that case).
-
I tired with bluetooth desktop manager.
With bluetoothctl I get
info 00:00:00:33:9B:58
Device 00:00:00:33:9B:58 (public)
Name: Umido ESoul DH2
Alias: Umido ESoul DH2
Class: 0x00000508
Icon: input-gaming
Paired: yes
Trusted: yes
Blocked: no
Connected: no
LegacyPairing: yes
UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
Modalias: usb:v0201p0009d0001
RSSI: -41
and with connect 00:00:00:33:9B:58
Device 00:00:00:33:9B:58 Connected: yes
Device 00:00:00:33:9B:58 ServicesResolved: yes
Failed to connect: org.bluez.Error.NotAvailable
Device 00:00:00:33:9B:58 ServicesResolved: no
Device 00:00:00:33:9B:58 Connected: no
It appears either support for Human Interface Device or PnP is not available
More when I tried joydev approach ...
-
You likely need the uinput kernel module loaded. But there may be others you need.
-
Hi uutzinger
The org.bluez.Error.NotAvailable message shows up in this thread:
https://forum.tinycorelinux.net/index.php/topic,25245.msg161269.html#msg161269
That thread deals with a bluetooth keyboard, but it might contain some ideas
that apply to your situation too.
-
Device 00:00:00:33:9B:58 Connected: yes
Device 00:00:00:33:9B:58 ServicesResolved: yes
Failed to connect: org.bluez.Error.NotAvailable
Device 00:00:00:33:9B:58 ServicesResolved: no
Device 00:00:00:33:9B:58 Connected: no
That is what I remember happening before I added and loaded the joydev module. Although mine didn't automatically become a mouse after connecting, I was only looking to use it as a joystick device.
-
The org.bluez.Error.NotAvailable message shows up in this thread:
https://forum.tinycorelinux.net/index.php/topic,25245.msg161269.html#msg161269
That thread deals with a bluetooth keyboard, but it might contain some ideas
that apply to your situation too.
This was helpful (and embarrassing as I read that thread before but I did not realize there was second page).
I tested it with a bluetooth keyboard and it worked, except for Ctrl-key.
Then I was able to extract joydev.ko and copied it to system. I also added a line to modules.dep so that modprobe could find it.
After modprobe uhid, uinput and joydev the game pad connected. Yeah.
After startx, the joytstick worked like a mouse and the main button as mouse-click. Great!
Thanks very much.
Next step is to figure out pybluez and pyserial, but that is for an other post....