Bluetooth device on gameshell

bluetooth
hardware
tinkering

#21
cpi@clockworkpi:~$ systemctl status rc-local
● rc-local.service - /etc/rc.local Compatibility
   Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
  Drop-In: /lib/systemd/system/rc-local.service.d
           └─debian.conf
   Active: active (running) since Sun 2018-10-21 06:26:17 UTC; 22h ago
   CGroup: /system.slice/rc-local.service
           └─753 brcm_patchram_plus --patchram /lib/firmware/brcm/bcm43438a0.hcd --enable_hci --bd_addr B0:F1:EC:2D:07:5B --no
lines 1-7/7 (END)

#22

thx U. I am not a linux expert, but will the rc.local.service config like below:
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target


#23

I am not a linux expert,either :slight_smile:

why you look into rc.local.service, I think rc.loal.service is fine with default content

just run systemctl start rc-local will enable rc.local.service at boot so that /etc/rc.local will be invoked at boot,too,

in ssh ,just run the scripts below, maybe copy and paste all into ssh

cat <<EOF >/etc/rc.local
#!/bin/sh -e
sleep 15
brcm_patchram_plus --patchram /lib/firmware/brcm/bcm43438a0.hcd --enable_hci --bd_addr B0:F1:EC:2D:07:5B --no2bytes --tosleep 5000 /dev/ttyS1 &
EOF
chmod +x /etc/rc.local
systemctl daemon-reload
systemctl start rc-local
systemctl status rc-local

systemctl enable bluetooth
reboot

and just in case

if you did not see the launcher up but only a loading…

into ssh

cd ~/launcher <- or cd ~/apps/launcher
DISPLAY=:0 ./load.sh

see if there are other problems


#24

it seems that after running systemctl start rc-local, it doesn’t enable rc.local.service. at boot. but probably I need to figure it out. do we need to run the bluetoothctl to connect device everytime we start the clockworkpi?


#25

The launcher can connect bluetooth devices now ,but without pair code
it seems bluetooth > 2.1 can pair without code

But every time you connect to a Bluetooth device, you need to connect it again with launcher or bluetoothctl

right now I don’t know how to make a bluetooth device auto-reconnect efficiently


#26

hi sir,

“bluetooth in launcher alpha now” i cant find the code inside the 1.22 launcher update.

please help.

thanks


#27

what you mean cant find the code inside the 1.22 launcher ?

you mean the source code or bluetooth pair code?


#28

you said “check out the newest code of launcher then you will see it”. are you saying there is a bluetooth.sh able to scan bluetooth device and connect them? right now i can only use putty to scan and connect my bluetooth controllers. just want to make sure if everyone is doing to same?

thanks


#29

the code is python

In launcher under settings
there is a new item named “bluetooth” now

do the same job as cli scan and connect bluetooth


#30

yes sir, i manage to see the bluetooth folder and manage to make it work. its awesome. thanks!


#31

hi Nabee,
How do you add the joystick config in retroarch. i finally managed to get the joystick connected via bluetooth, thx to guu and your guidance. but the joystick didn;t response any input.

Regards,
Ed


#32

work it out after a few retries on tinkering…thx Nabee with all the instruction on adding joystick on Bluetooth.


#33

it works alright after having the Bluetooth UI added in launcher. would have been nice to auto connect :slight_smile:. I notice after adding the Bluetooth, the navigation within the CPI UI can freeze up occasionally. does it happen to the other as well?


#34

more detail about the freeze up occasionally ,please


#35

I might have used the wrong term on freeze, it’s slow down the UI for 5-10 sec, especially when scrolling game list or navigating the CPI OS settings. but afterwards they are ok. not really a big issue.


#36

so now with clockworkpiOS 0.3 bt is working out of the box. But how can I connect the 8 Bitdo Zero GamePad to get it working I managed to use the OS-X mode (keyboard) and when I bind it, the keys are recognised well. But I can’t get it in games e.g. on snes


#37

Hello! PocketPC.ch.
Sorry for the late reply.

I also tried it with OS v0.3, and it worked fine.
Maybe you do not need to turn 8 Bitdo Zero GamePad into Keyboard Mode.
Do you recognize GamePad properly in Retroarch?
If you recognize it, at Retroarch launch, you will see a message like “8bit do Zero Gamepad not configured” with yellow letters at the bottom left of the screen.


If it is not recognized, copy retroarch.cfg somewhere,(←Strongly recommended.)
execute the following on the command line,

sudo usermod -a -G input cpi

Please try starting Retroarch again.
Assign the button with BindAll.


#38

thanks but unfortunately that did not help. there is no user whoami. I now did all the steps (except from enable bluetooth) on a fresh install of cpiOS 0.3. I added the user cpi to the group input. I created the 10-local.rules file as you suggested and reloaded the udev rules.

When I look ad dmesg, I get
Bluetooth: hci0: last event is not cmd complete (0x0f) just after I connected in Windows-Mode.

I also tried to use the hid
In regular Android mode, I get
[ 1296.395205] hid-generic 0005:05A0:3232.0007: unknown main item tag 0x0 [ 1296.402337] input: 8Bitdo Zero GamePad as /devices/platform/soc@1c00000/1c28400.serial/tty/ttyS1/hci0/hci0:12/0005:05A0:3232.0007/input/input15 [ 1296.415953] hid-generic 0005:05A0:3232.0007: input: BLUETOOTH HID v1.09 Gamepad [8Bitdo Zero GamePad] on b0:f1:ec:2d:07:5b

and udevadm monitor, I get

yS1/hci0/hci0:11 (bluetooth)
KERNEL[1280.664788] add /devices/platform/soc@1c00000/1c28400.serial/tty/ttyS1/hci0/hci0:11 (bluetooth)
UDEV [1280.671252] add /devices/platform/soc@1c00000/1c28400.serial/tty/ttyS1/hci0/hci0:11 (bluetooth)
KERNEL[1281.010348] remove /devices/platform/soc@1c00000/1c28400.serial/tty/ttyS1/hci0/hci0:11 (bluetooth)
UDEV [1281.013944] remove /devices/platform/soc@1c00000/1c28400.serial/tty/ttyS1/hci0/hci0:11 (bluetooth)
KERNEL[1289.501887] add /devices/platform/soc@1c00000/1c28400.serial/tty/ttyS1/hci0/hci0:11 (bluetooth)
UDEV [1289.508097] add /devices/platform/soc@1c00000/1c28400.serial/tty/ttyS1/hci0/hci0:11 (bluetooth)
KERNEL[1289.810360] remove /devices/platform/soc@1c00000/1c28400.serial/tty/ttyS1/hci0/hci0:11 (bluetooth)
UDEV [1289.813808] remove /devices/platform/soc@1c00000/1c28400.serial/tty/ttyS1/hci0/hci0:11 (bluetooth)
KERNEL[1291.519303] add /devices/platform/soc@1c00000/1c28400.serial/tty/ttyS1/hci0/hci0:12 (bluetooth)
UDEV [1291.525526] add /devices/platform/soc@1c00000/1c28400.serial/tty/ttyS1/hci0/hci0:12 (bluetooth)
KERNEL[1296.398004] add /devices/platform/soc@1c00000/1c28400.serial/tty/ttyS1/hci0/hci0:12/0005:05A0:3232.0007 (hid)
KERNEL[1296.417584] add /devices/platform/soc@1c00000/1c28400.serial/tty/ttyS1/hci0/hci0:12/0005:05A0:3232.0007/input/input15 (input)
UDEV [1296.417865] add /devices/platform/soc@1c00000/1c28400.serial/tty/ttyS1/hci0/hci0:12/0005:05A0:3232.0007 (hid)
UDEV [1296.418180] add /devices/platform/soc@1c00000/1c28400.serial/tty/ttyS1/hci0/hci0:12/0005:05A0:3232.0007/input/input15 (input)
KERNEL[1296.419151] add /devices/platform/soc@1c00000/1c28400.serial/tty/ttyS1/hci0/hci0:12/0005:05A0:3232.0007/input/input15/event2 (input)
UDEV [1296.623789] add /devices/platform/soc@1c00000/1c28400.serial/tty/ttyS1/hci0/hci0:12/0005:05A0:3232.0007/input/input15/event2 (input)

and even though RetroArch is set to udev as type for Joypads, it does not see the device at all and the Device Index stays Disabled


#39

I also tried to use the Driver hid for Joypads in RetroArch as udevadm persists on looking at it as hid-generic device. no luck. so neither udev nor linuxraw nor hid are usefull.
But if I use sdl2 as driver, it shows me the 8Bitdo Zero would not be configured! Only binding doesn’t work.


#40

dang I got it! sdl2 as driver works correctly! but RA grabbed the gamepad and assigned it to Input 1. that’s why it was disabled for Input 2 :expressionless:
IO removed the udev rule now and I am looking forward to happy gaming with my kids :joy: