TheWeirdDev / Bluetooth_Headset_Battery_Level

A python script to get battery level from Bluetooth headsets
GNU General Public License v3.0
760 stars 83 forks source link

Container does seems not to work #68

Closed a10sbraun closed 2 years ago

a10sbraun commented 2 years ago

As I had no success via PIP I thought, let´s try a container as there are the libs guranteed.

I created the container and faced no issue during building but I can not run it not as user nor as root. I always get the following error (regardles if root or user):

podman run --rm -ti --privileged --net=host bluetooth_battery_level 88:D0:39:BB:4A:76

[2] Error loading Python lib '/tmp/_MEIx6iKbm/libpython3.9.so.1.0': dlopen: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/_MEIx6iKbm/libpython3.9.so.1.0)

as_user.log as_root.log

patrickwoolf commented 2 years ago

same here

TheWeirdDev commented 2 years ago

Hi, sorry for the late response. I've updated the Dockerfile and now it seems to work. Can you give it a try?

TheWeirdDev commented 2 years ago

It is also on DockerHub! (bluetooth_battery) It would be great if someone could test and confirm it's working.

a10sbraun commented 2 years ago

Seems to work (the container) however my headset not, but I assume that it not due to the container, as the extension does not work as well (JBL LIVE 650BTNC)... Just Android and Windows is able to show the percentage... that sucks...

podman run --rm -ti --privileged  bluetooth_battery:1.3.1 "88:D0:39:BB:4A:76"
Traceback (most recent call last):
  File "/app/./bluetooth_battery.py", line 166, in <module>
    main()
  File "/app/./bluetooth_battery.py", line 162, in main
    query = BatteryStateQuerier(*device.split("."))
  File "/app/./bluetooth_battery.py", line 81, in __init__
    self._bt_settings = bluetooth_mac, int(bluetooth_port or RFCOMMSocket.find_rfcomm_port(bluetooth_mac))
  File "/app/./bluetooth_battery.py", line 60, in find_rfcomm_port
    raise bluetooth.BluetoothError("Couldn't find the RFCOMM port number. Perhaps the device is offline?")
bluetooth.btcommon.BluetoothError: Couldn't find the RFCOMM port number. Perhaps the device is offline?
TheWeirdDev commented 2 years ago

Mind trying a couple more times? I got that error on the first try but the next time it worked. Also try specifying the port number manually with a dot at the end (e.g: 88:D0:39:BB:4A:76.1). Numbers from 1 to 30-ish might work. If those didn't do the trick then you are probably right. The script doesn't support all devices.