deragon / autopoweroff

Manage automatic poweroff and other actions (suspend / custom) when specific conditions are reunited.
GNU General Public License v2.0
52 stars 7 forks source link

Systems with a KVM switch #5

Closed rac8006 closed 3 years ago

rac8006 commented 5 years ago

Autopoweroff has problem with loss of keyboard when switched to a different system. Once it detects the loss of the keyboard it finishes the ApoObserverDevice threads. Not what should be done with this condition. The problem is that when you return the keyboard to the system it will shutdown even while you are typing.
Maybe the autopoweroff should close the file and go into a sleep/wait looking for the keyboard. When the keyboard is returned open the file again. Not sure if the system should be tun=rned off if the keyboard is missing for the idletime.

deragon commented 3 years ago

I started working on this problem. Hopefully it will be fixed in the next few weeks. No promises though.

rac8006 commented 3 years ago

It is fixed in the code I tried to upload.

Sent from Mail for Windows 10

From: Hans Deragon Sent: Thursday, February 25, 2021 9:16 AM To: deragon/autopoweroff Cc: rac8006; Author Subject: Re: [deragon/autopoweroff] Systems with a KVM switch (#5)

I started working on this problem. Hopefully it will be fixed in the next few weeks. No promises though. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

-- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

deragon commented 3 years ago

Yes! I remember our exchanges now. Well, I modified the code to make use of pyinotify to dynamically change the list of devices to track as they are added and removed. The code is still local on my laptop, but I plan to upload it soon in the official repository.

rac8006 commented 3 years ago

I was not aware of pyinotify. Here is what I did. It was a quick and dirty fix. It has been working since August. try: fd.read(1) except IOError as ioerror: if ioerror.errno == errno.ENODEV: sendmsg("Device " + self.sDevice + " absent (No such device error)", \ priority=syslog.LOG_NOTICE) fd.close() while not Path(self.sDevice).exists(): time.sleep(60) fd = open(self.sDevice, 'rb') continue

Sent from Mail for Windows 10

From: Hans Deragon Sent: Sunday, February 28, 2021 12:13 PM To: deragon/autopoweroff Cc: rac8006; Author Subject: Re: [deragon/autopoweroff] Systems with a KVM switch (#5)

Yes! I remember our exchanges now. Well, I modified the code to make use of pyinotify to dynamically change the list of devices to track as they are added and removed. The code is still local on my laptop, but I plan to upload it soon in the official repository. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

-- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

deragon commented 3 years ago

Fixed with Autopoweroff 4.0.0.