Giter VIP home page Giter VIP logo

Comments (8)

Aylur avatar Aylur commented on July 17, 2024

It shows not connected, but the device is still connected?

I can't seem to recreate this.
If I do systemctl suspend and wake up everything goes back to normal

from dotfiles.

cafetestrest avatar cafetestrest commented on July 17, 2024

Yeah, exactly.
Here is the terminal output from bluetooth/label connections:
https://imgur.com/a/v58cX6l

from dotfiles.

cafetestrest avatar cafetestrest commented on July 17, 2024

Hi @Aylur ,
I have a bit more details, unsure if this is happening to me due to having PC with dongle for Bluetooth 5.0 or just a general issue that doesn't happen to you, but here is what I found:

After a systemctl suspend is trggered and PC is waken up, I'm unable to retrieve a list of connectedDevices, but I still retrieve list of Bluetooth devices just fine.
Connected devices size is 0, but at never point I've disconnected any device.

I have BT keyboard and mouse which both work fine after sleep.

If you have any suggestions of what I can put to the console.log to further guide us into finding a solution, I will drop an output.
Thank you.

from dotfiles.

Aylur avatar Aylur commented on July 17, 2024

save this script to a file

const { USER, writeFile } = ags.Utils;
const { instance } = ags.Service.Bluetooth;

let output = '';
const logger = msg => {
    const c_ids = [];
    for (const [, d] of instance.devices)
        c_ids.push(JSON.stringify(d._ids))

    output += `
##### ${msg} #####
_getDevices ${instance._getDevices().length}
state ${instance.state}
devices ${instance.devices.size}
connectedDevices ${instance.connectedDevices.size}
c_ids ${JSON.stringify(c_ids, null, 2)}
`;
}

logger('start');

instance._getDevices().forEach(d => {
    instance._deviceRemoved(null, d);
});

logger('removed');

instance._getDevices().forEach(d => {
    instance._deviceAdded(null, d);
});

logger('added');

print(output)

try {
    writeFile(output, `/home/${USER}/ags.log`);
} catch (error) { }

then run

ags &&
ags run-js "$(cat script.js)"
cat ~/ags.log

what is the output?

from dotfiles.

cafetestrest avatar cafetestrest commented on July 17, 2024

Hi @Aylur ,
OK strange thing happens, when I go back from sleep, bluetooth is still showing Not connected, but as soon as I run the command ags run-js "$(cat script.js)" it appears again. Both icons for BT devices and in QuickSettings it shows as 2 connected as well. I guess something in the logic is refreshing Bluetooth Service state perhaps?

Here are the differences:
https://imgur.com/a/jVU380c

(on the left side is when everything is working fine, on the right it is after wake from sleep and running of the command)

from dotfiles.

cafetestrest avatar cafetestrest commented on July 17, 2024

After a bit of script tweaking this is the bare minimum what seems to reset it when I run the command: ags run-js "$(cat script.js)"

const { instance } = ags.Service.Bluetooth;

instance._getDevices().forEach(d => {
    instance._deviceRemoved(null, d);
});

instance._getDevices().forEach(d => {
    instance._deviceAdded(null, d);
});

This somehow adds back the icons to the topbar and updates the service, though css is not applied this way :)

from dotfiles.

Aylur avatar Aylur commented on July 17, 2024

This script essentially forces a reread from GnomeBluetooth.
So it seems your issue is caused either by gnomebluetooth not emitting the signal (which I doubt),
or something specific on your setup that ags doesn't account for (which is more likely).
I will have to read a bit more into gnomebluetooth, in the meantime you can run this script after suspend or restart ags as a temporary fix.

from dotfiles.

cafetestrest avatar cafetestrest commented on July 17, 2024

I've applied the hack to run every minute or so on a interval to check for the status of Not connected, just as a temporary hotfix.

I'm unsure if I did break anything, but my config is basically your dotfiles, with small modifications and removal of some things I didn't need.
I would assume it is just the difference between using a dongle and integrated chip for Bluetooth.

from dotfiles.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.