joycontrol
joycontrol copied to clipboard
KeyError: 'Name', BlueZ API yields invalid responses

@JakkFish weird, will look into it. This is some convinience code to sanity check the given parameters.
The hotfix: Go into joycontrol/joycontrol/device.py and change the get_paired_switches(self) definition to be the following:
def get_paired_switches(self):
return []
This will cause the pairing-detection to fail, meaning -r auto and unpairing sanity-check will no longer work.
A few more questions:
- OS
- BT-controller
- bluez-version
- If you want to, try using
d-feet(might have to install) to look for some object with theorg.bluez.Device1interface inside theorg.bluezservice on the System-bus that has noNameProperty.
Okay i will try the code in a second also my OS is Ubuntu 20.04.2 LTS and im using Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode) [8891] My bluez version 5.53 and i searched d-feet and im not sure what you mean but i have a picture im going to send of what i see
also I changed def get_paired_switches(self):
switches [ ] to
def get_paired_switches(self):
return [ ]
Ok, that were the pictures I needed, thanks. The first two show some statisctics about the service I presume (I don't have them, maybe my dfeet is outdated). The last picture however is interesting.
The default bluez interface is there (/org/bluez) and it's offering all the default interfaces, but there is no controller (/org/bluez/hciX). That would suggest you don't have bluetooth, but you stated you do (do the Bluetooth settings in ubuntu work?).
Does bluetoothctl show show someting?
My Bluetooth settings work I replugged my Bluetooth dongle and I see some other stuff in d-feet

Also I used Bluetoothctl in terminal and I see a really long code and it’s still going do you need a picture of that?
oh and also I replaced the code should I try to run the script again?
yep, now the controller shows up. Try it (maybe even without the modification)
Ok so I tried it and I got this

then I removed the = and got this

without modifications it’s same as the first picture I posted
see #4 "how it should be"
i tried running ExecStart=/usr/lib/bluetooth/bluetoothd -C -P sap,input,avrcp but it says "-C: command not found"
/lib/systemd/system/bluetooth.service also permission denied and idk what to do from there
Are you root?
(Almost) nothing in this repo works as regular user. Use sudo su (not recommended) to permanently become root or prefix a command with sudo to run this command as root. To edit a file e.g. sudo nano /lib/systemd/system/bluetooth.service.
I don’t think I’m root I’m using virtual box but did I do this right?

Good news I see this now using return [] or switches = [ ]
Which should I use though? The modify or regular? and sorry for commenting so much thank you for helping me!
And also if you can answer one last question- How do i change the name? in /etc to Pro Controller
No need to change name. Its done automatically And you forgot to reload and restart the service.
The only problem is I have to restart ubuntu every time i run joycontrol because after i stop it or something errors i get this again 
other then that everything is working nice!
Ok, after some testing of my own i figured this is some issue with the BlueZ Dbus-API.
Sometimes after restarting the daemon this occurs, and the effect is consintent across Applications. (E.g. d-Feet also just dies when trying to access the Name field)
I'll try to come up with some workaround, but for now this only ever happened on ubuntu and even there is hard for me to reproduce. The main problem with fixing this is it's out of joycontrol's control. And ignoring might not be an option since when the dbus-api is broken there are a few more problems down the road.
For more technical readers: The Name property that is expected inside the Device1 is just absent for some reason and GetAll or similar dictionary-lookups just forgo reporting it.