Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with Device is Offline error #58

Open
mhkarimi1383 opened this issue Apr 25, 2021 · 13 comments
Open

Problem with Device is Offline error #58

mhkarimi1383 opened this issue Apr 25, 2021 · 13 comments

Comments

@mhkarimi1383
Copy link

When I want to get my headphone battery I Get this error
<Device MAC> is offline [Errno 16] Device or resource busy

And please update gnome extension for gnome 40

@rds8rds
Copy link

rds8rds commented Jun 12, 2021

When I want to get my headphone battery I Get this error
<Device MAC> is offline [Errno 16] Device or resource busy

And please update gnome extension for gnome 40

Does it work on the older gnome desktop, like 3.38. I faced the same error.

@barak
Copy link

barak commented Jun 15, 2021

Used to work for me as well, now I get this.

$ bluetoothctl info
Device E8:AB:FA:27:9F:49 (public)
	Name: iTeknic IK-BH002
	Alias: Black Noise-Cancelling (iTeknic IK-BH002)
	Class: 0x00240418
	Icon: audio-card
	Paired: yes
	Trusted: yes
	Blocked: no
	Connected: yes
	LegacyPairing: no
	UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
	UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
	UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
	UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
	UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
	Modalias: bluetooth:v000ApFFFFdFFFF

$ ~/src/git/Bluetooth_Headset_Battery_Level/bluetooth_battery.py E8:AB:FA:27:9F:49
E8:AB:FA:27:9F:49 is offline [Errno 111] Connection refused

@mhkarimi1383
Copy link
Author

I think it's not compatible with some devices
mine is Anker Sound buds lite

@mhkarimi1383
Copy link
Author

Used to work for me as well, now I get this.

$ bluetoothctl info
Device E8:AB:FA:27:9F:49 (public)
	Name: iTeknic IK-BH002
	Alias: Black Noise-Cancelling (iTeknic IK-BH002)
	Class: 0x00240418
	Icon: audio-card
	Paired: yes
	Trusted: yes
	Blocked: no
	Connected: yes
	LegacyPairing: no
	UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
	UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
	UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
	UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
	UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
	Modalias: bluetooth:v000ApFFFFdFFFF

$ ~/src/git/Bluetooth_Headset_Battery_Level/bluetooth_battery.py E8:AB:FA:27:9F:49
E8:AB:FA:27:9F:49 is offline [Errno 111] Connection refused

same here

@Kronodile
Copy link

Hi, try connecting to a different port. For example bluetooth_battery.py E8:AB:FA:27:9F:49.1
Try manually changing the numbers from 1 to 30 after period (.)

@barak
Copy link

barak commented Jun 21, 2021

@Kronodile That didn't help for me, but bluetoothctl disconnect E8:AB:FA:27:9F:49 followed by bluetooth_battery.py E8:AB:FA:27:9F:49 both got the battery level and reconnected it. And then it worked, and battery queries also worked.

@jrvgr
Copy link

jrvgr commented Jul 29, 2021

@Kronodile That didn't help for me, but bluetoothctl disconnect E8:AB:FA:27:9F:49 followed by bluetooth_battery.py E8:AB:FA:27:9F:49 both got the battery level and reconnected it. And then it worked, and battery queries also worked.

i also have this issue

@dark-dryu
Copy link

dark-dryu commented Sep 13, 2021

@Kronodile That didn't help for me, but bluetoothctl disconnect E8:AB:FA:27:9F:49 followed by bluetooth_battery.py E8:AB:FA:27:9F:49 both got the battery level and reconnected it. And then it worked, and battery queries also worked.

i also have this issue

same here, but the battery queries did not work afterwards

@lakinduakash
Copy link

@Kronodile That didn't help for me, but bluetoothctl disconnect E8:AB:FA:27:9F:49 followed by bluetooth_battery.py E8:AB:FA:27:9F:49 both got the battery level and reconnected it. And then it worked, and battery queries also worked.

This is what worked for me

@VanillaBase1lb
Copy link

@Kronodile That didn't help for me, but bluetoothctl disconnect E8:AB:FA:27:9F:49 followed by bluetooth_battery.py E8:AB:FA:27:9F:49 both got the battery level and reconnected it. And then it worked, and battery queries also worked.

i also have this issue

This worked for me too

@VoidPhantom
Copy link

I am observing the same problem after upgrading to Ubuntu 21.10. To be clear, the Gnome extension that uses this script — and, therefore, presumably, the script itself — used to work just fine with Ubuntu 21.04 up until I upgraded to Ubuntu 21.10.

Now, if I connect my Bluetooth headphones and run the script, it gives the following error:

[REDACTED] is offline [Errno 16] Device or resource busy

If I try manually specifying ports from 1 to 30, it gives the same error with port 4, and with any other port is gives the following error:

[REDACTED] is offline [Errno 111] Connection refused

If I disconnect the headphones and run the script, then it suddenly works! But, unlike reported by others above, this does not fix the issue for me. If I run the script while the headphones are disconnected, it successfully returns a charge level, and the headphones say, “Bluetooth disconnected,” and remain disconnected. It seems that the script briefly connects to the headphones, requests the charge level, and then disconnects. If I then reconnect the headphones, the script still gives the same error while the headphones are connected.

Interestingly, this problem appears to be somewhat intermittent: while testing again in order to write this comment, for a brief moment the script actually managed to work correctly and report the battery charge level while the headphones were connected! I wasn’t able to reproduce this, though; the scenario I described above is still the only thing that happens reliably.

@adi-g15
Copy link

adi-g15 commented Oct 28, 2021

I also faced the problem, for some devices (my headphone atleast), it fails to establish a connection, I wrote this script to do the same, just disconnect for a moment, check battery, then connect back again (if you don't want to, edit it to add some, say a flag):

#!/usr/bin/python
import re
import sys
import os
from bluetooth_battery.bluetooth_battery import main
if __name__ == '__main__':
    os.system("bluetoothctl disconnect "+ sys.argv[1])
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    main()
    os.system("bluetoothctl connect "+ sys.argv[1])

And save it as 'bluetooth_battery' in ~/.local/bin... done :D

@im-n1
Copy link

im-n1 commented Nov 4, 2021

Exactly the same issue.

image

The thing is you dont wanna disconnect from the headphones as you are listening to a music.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests