idasen-controller icon indicating copy to clipboard operation
idasen-controller copied to clipboard

Locking computer stops table from moving

Open Slade01202 opened this issue 3 years ago • 3 comments

First of all, thank you for this script.

I use KDE running on Manjaro as well as the Linak DPG1C. The script runs fine until I lock my PC. After locking and unlocking, executing the script produces the following output:

Connected EA:69:XX:CE:XX:9C
Height:  641mm
Moving to favourite height: stand
Height:  641mm Speed:  0mm/s
Final height:  641mm (Target: 1116mm)
Disconnected 

I have only been able to fix it by connecting the phone app to my desk, moving it a centimeter, disconnecting, and executing the script again:

Connected EA:69:XX:CE:XX:9C
Height:  641mm
Moving to favourite height: stand
Height:  644mm Speed: 25mm/s
Height:  660mm Speed: 61mm/s
Height:  681mm Speed: 62mm/s
Height:  706mm Speed: 62mm/s
Height:  728mm Speed: 62mm/s
Height:  750mm Speed: 62mm/s
Height:  772mm Speed: 62mm/s
Height:  796mm Speed: 62mm/s
Height:  818mm Speed: 62mm/s
Height:  839mm Speed: 62mm/s
Height:  862mm Speed: 62mm/s
Height:  886mm Speed: 62mm/s
Height:  911mm Speed: 62mm/s
Height:  934mm Speed: 62mm/s
Height:  957mm Speed: 62mm/s
Height:  978mm Speed: 62mm/s
Height: 1001mm Speed: 62mm/s
Height: 1022mm Speed: 62mm/s
Height: 1045mm Speed: 62mm/s
Height: 1068mm Speed: 62mm/s
Height: 1091mm Speed: 62mm/s
Height: 1114mm Speed: 62mm/s
Height: 1116mm Speed:  0mm/s
Final height: 1116mm (Target: 1116mm)
Disconnected

Slade01202 avatar Oct 20 '22 14:10 Slade01202

If you lock and then unlock and then re-pair with the desk without using the phone, does that also fix it? Or not?

rhyst avatar Oct 20 '22 16:10 rhyst

Yes, that doesn't work either, unfortunately.

Slade01202 avatar Oct 21 '22 06:10 Slade01202

What about if you restart your computer? Is it just locking that causes this issue?

And do you happen to have a second device to test with? I.e. does it work if you run run idasen controller on some other device rather than using the phone?

rhyst avatar Oct 21 '22 07:10 rhyst

Similar issue here. Same solution: I can only get it back to work if I connect with my phone, move it a bit and then unpair the phone and connect to idasen back again

mensfeld avatar Apr 24 '23 07:04 mensfeld

Received command
Height:  762mm
Moving to height: 730
Height:  762mm Speed:  0mm/s
Final height:  762mm (Target:  730mm)

never moves

mensfeld avatar Apr 24 '23 07:04 mensfeld

What about if you restart your computer?

And do you have a second device to test with? I.e. does it work if you run run idasen-controller on some other device rather than using the phone?

rhyst avatar Apr 24 '23 07:04 rhyst

What about if you restart your computer?

Didn't help. What i noticed, is that it does not respond to action commands (move up, move down) but the position and speed can be read without any issues.

The only other device I have at the moment is my phone I use to "unblock" the desk.

I am using Ubuntu and my Bluetooth adapter has a second device (headphones) connected to it in a multi profile mode.

It seems, like my desk is ignoring the commands for any reason (write pace or something else). I will try getting a second bluettoh dongle and check if a single device - single connection via independent Bluetooth adapters help here.

mensfeld avatar Apr 24 '23 07:04 mensfeld

Yeah, it just seems to ignore the action commands (move, stop) but it does not ignore the status command (height / speed)

mensfeld avatar Apr 24 '23 08:04 mensfeld

That is quite strange. Both reading characteristics (height/speed) and writing characteristics (commands like move) are both just BLE requests to the desk so if reading works then the controller is connected and capable of communicating with the desk.

It suggests that somehow something happens to the desk when you lock your computer vs when you shut it down. I don't think there should be any communication between the desk and computer at that point so I don't know what is going on.

Some other questions if you are willing:

  • What OS are you using?
  • Are you using the "server" mode or just running the script standalone?
  • Before locking your computer un-pair the desk, then lock, unlock and re-pair. Does the desk respond to move commands?
  • If you have a laptop, what happens if you walk far out of BLE range (5-10 meters) and then come back after a few minutes (without locking)? Does the desk respond to move commands?
  • If you have a laptop, what happens if you walk far out of BLE range (5-10 meters) and then lock your desk and then come back and unlock? Does the desk respond to move commands?

Trying to work out if your computer is maintaining some sort of connection to the desk while it is paired and locking messes it up somehow. Otherwise I don't know how the desk would "know" that your computer had been locked.

rhyst avatar Apr 24 '23 09:04 rhyst

  1. Ubuntu 20.04
  2. Server mode. After long inactivity and lock screen. I don't think that "locking" does that per se but rather something related to 3. IMHO power management on ubuntu USB. I disabled the USB suspend from Bluetooth and we will see once I have time to get back to this.
  3. I don't use a laptop :( sorry

Otherwise I don't know how the desk would "know" that your computer had been locked.

I don't think it's that. I think it's related to some sort of a faulty communication when Bluetooth is switched via USB suspend or something similar.

I also consider it weird because I can read position and I can observe it and speed when moving the desk manually.

I wonder if the wake up command is not sufficient / not fully waking up but :shrug:

mensfeld avatar Apr 24 '23 12:04 mensfeld

I disabled USB suspend and after a full restart I'm certain there's something "extra" that needs to be sent to the desk to activate it back.

mensfeld avatar Apr 24 '23 12:04 mensfeld

Does this happen if you don't use the server mode?

rhyst avatar Apr 24 '23 12:04 rhyst

Also what happens if you restart the idasen-controller server after locking? Do the move commands till fail?

rhyst avatar Apr 24 '23 12:04 rhyst

Also what happens if you restart the idasen-controller server after locking? Do the move commands till fail?

Yes

Does this happen if you don't use the server mode?

It happened to me once when it was NOT in the server mode. I will do my best to get a reproducibility here.

mensfeld avatar Apr 24 '23 12:04 mensfeld

It makes more sense if this is an issue with the server mode as that does maintain a persistent connection so I can imagine that somehow messing up due to locking/power saving things. Would be interested to know if you can reproduce in non server mode.

Also I disabled the USB suspend from Bluetooth - let me know if that improves things and I could add it to the readme.

I'm seeing if I can reproduce on Windows as well (now that I know its more likely a server mode issue).

rhyst avatar Apr 24 '23 12:04 rhyst

Sure. I will keep you posted. For now I did few things:

  1. I disabled the USB suspend completely via kernel, so it does not switch the Bluetooth dongle off / low power.
  2. I disabled the wakeup command in the script "just to see" what will happen.
  3. I set up probing of the server process to get the desk status once every minute - just to see if having a constant (one time a minute) ping to the desk makes things better.

mensfeld avatar Apr 24 '23 12:04 mensfeld

Didn't help. During the night it went down. That is, it started returning height 0 and then it started returning height 9123 :D my script pings it every minute. Will unlock and switch to a non-server mode and see what will happen then.

mensfeld avatar Apr 25 '23 08:04 mensfeld

I also don't think it's "locking" that causes this but it seems to be more related to persistent Bluetooth connection maybe or something like this.

Switched to non-server mode, we will see how it goes. I still track the metrics so it should operate ok.

mensfeld avatar Apr 25 '23 08:04 mensfeld

Same thing happens despite disconnecting working:

Moving the desk down in 15 seconds
Connected E6:8E:71:B5:6B:FD
Height: 1236mm
Moving to height: 750
Height: 1236mm Speed:  0mm/s
Final height: 1236mm (Target:  750mm)

no movement at all

mensfeld avatar Apr 25 '23 10:04 mensfeld

How are you running idasen-controller ? Can you post the exact command/script?

rhyst avatar Apr 25 '23 10:04 rhyst

nothing fancy just moving up and down.

idasen-controller --move-to 750

now as it is stuck, if I pair it with my phone, unpair it, pair it with the computer, it can move like nothing happened. I still can get the position though with --watch :shrug:

It's like the desk decides "ok, this Bluetooth device was moving me or sampling me too much, won't allow it to move the desk anymore'

mensfeld avatar Apr 25 '23 10:04 mensfeld

ref https://github.com/alex20465/deskbluez/issues/7

mensfeld avatar Apr 25 '23 13:04 mensfeld

@mensfeld does the DPGC1 update also fix this issue?

rhyst avatar Oct 31 '23 09:10 rhyst

Fixed by DPC1 updates (reopen if that is not the case)

rhyst avatar Nov 01 '23 13:11 rhyst

@rhyst it does fix the issue :)

mensfeld avatar Nov 01 '23 16:11 mensfeld