LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 09-10-2021, 10:43 AM   #1
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 244

Rep: Reputation: Disabled
Turning off USB port power


For many years now, we've been able to have our monitor screens go blank after a specified period of inactivity to save power.

More recently, however, we now have backlit keyboards and other USB devices, few of which seem to have any timeouts of their own. This became more apparent than ever to me after I recently purchased a very nice monitor-mounted USB-powered task light (https://www.amazon.com/dp/B08DKQ3JG1...roduct_details). Now if I walk away from the desk, the monitor will shut down nicely, but the task light and keyboard backlight remain on unless I explicitly turn them off, which I sometimes don't do if I wrongly think I'm going to return in five minutes, but get distracted and return four hours later!

So I decided to see if I could do something about that. So far I've had no luck whatever. It is barely possible to do this for [some devices] with [some additional software] (e.g. fiddling with entries in "/sys/bus/usb/devices" or installing uhubctl), but the specifc USB port assignments seem to change with the weather (I do plug and unplug other peripherals, and suspect I always will) and, more importantly, some devices - in particular the task light I purchased and really like) - are not actually USB devices at all. They simply use the USB connector to draw power; they have no drivers, don't show up at all with the usual lsusb commands and the like.

So I experimented a bit with adding "usbcore.autosuspend=-1" to my grub CMDLINE. The chief problem with doing would of course be that neither the keyboard nor the mouse is "alive" enough to wake up the system when I return - probably why the commands seem to be deprecated.

Then I found a nice monitor that has an internal USB hub and wondered if it could be configured to cut off power to its hub (or, even better, to an individual port) when it got the "go dark" command from its HDMI port; that way I could plug the desk lamp into that (cleaning up cabling in the process!). I contacted a vendor that sells and supports that particular monitor and the answer was something like "no one ever asked that before, but it sounds like an interesting idea; let me check." So far, it's looking like such a product doesn't exist.

Thinking that I can't be the only user on the planet who had thought about doing something similar, I was wondering if anyone has found a practical solution for accomplishing such a "group sleep". There are now loads of USB-powered "things" one might want to shut off when leaving the desk (my son-in-law has a USB-powered fan for example), so I'd love to hear any ideas ... even if it's something embarrassingly obvious that I overlooked!

Stay safe.
 
Old 09-10-2021, 03:21 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,731

Rep: Reputation: 6315Reputation: 6315Reputation: 6315Reputation: 6315Reputation: 6315Reputation: 6315Reputation: 6315Reputation: 6315Reputation: 6315Reputation: 6315Reputation: 6315
Not sure what to do about the keyboard but I might consider buying an in line USB switch for the light. Just have to remember to turn it off...

There are master slave power outlets and you can use an external power adapter to plug in the light. When the computer goes to sleep or turns off so does the light.
 
Old 09-10-2021, 06:28 PM   #3
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 244

Original Poster
Rep: Reputation: Disabled
Thanks for responding, having to "remember to turn it off" is exactly what I'm trying to avoid.

But your other suggestion sounds interesting: can you provide a link to some such device? The light (and other devices) have only a USB connector for power - meaning they would each need an AC-to-USB adapter: not ideal, but I have several of those, so would be do-able.
 
Old 09-10-2021, 06:44 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,731

Rep: Reputation: 6315Reputation: 6315Reputation: 6315Reputation: 6315Reputation: 6315Reputation: 6315Reputation: 6315Reputation: 6315Reputation: 6315Reputation: 6315Reputation: 6315
Basically a smart surge protector that senses current on the master outlet and turns on/off the others.

https://www.amazon.com/ECG-7MVR-Ener...67620298&psc=1
 
Old 09-11-2021, 04:00 AM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
I have achieved something like that for a USB hard drive - maybe my notes can be of help. ... Ooops, I notice that there seems to be a difference between "disable" and "power off" - see the stackoverflow article linked therein. Still, worth a try I guess.

Last edited by ondoho; 09-12-2021 at 01:03 PM.
 
Old 09-12-2021, 09:40 AM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,976
Blog Entries: 46

Rep: Reputation: 3202Reputation: 3202Reputation: 3202Reputation: 3202Reputation: 3202Reputation: 3202Reputation: 3202Reputation: 3202Reputation: 3202Reputation: 3202Reputation: 3202
Member Response

Hi,

Maybe look at a wifi power switch that you could schedule through 'Alexa' to control a USB charge adapter for the light. I am sure you should be able to send/schedule commands to a 'Alexa' device. Maybe not monitor via your system unless you look at USB power management for the kernel but with a command schedule for such outside the system.

Kernel USB power management is still dependent on the device driver. So you could improvise a driver for that device.

Just a thought!
 
Old 09-12-2021, 10:44 AM   #7
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 244

Original Poster
Rep: Reputation: Disabled
Thanks all for your responses. My initial thoughts on each ...

michaelk: I looked at the device you mentioned and compared its power-draw sensitivity specs with the various monitors I use, and it seems like that might very well work for the USB-powered task lamp. At that price I'll order one just to experiment. But it wouldn't be appropriate as a general solution for a backlit keyboard since that would need to be connected to both the power strip and the PC to work. I suspect there's a (probably ugly) way to do that, but it's no longer 1985, and I was hoping for something more elegant. But if this strip works for even the light, that will be (as Neil Armstrong said) "One Giant Leap." I'll report back on how it works once I receive the device. Interestingly (as an aside), the specs on their single-sheet promo brochures and those in their actual user manuals differ; sigh ...

ondoho: Terrific write up on your "my notes" link by the way! Pretty much the same issue as my original posting though: the location of hard drives can generally be identified somehow, but I suspect things like the lamp don't even have any data lines, just a power line and ground. I've poked around in all the usual locations and the lamp never shows up in any USB or device query I make. My conclusion, which I hope is incorrect, is that only the monitor blanking its screen can reliably determine when the lamp should turn off.

onebuck: In my younger days, your suggestion would have prompted me to "play around," but I'm old and lazy enough that it seems too much like work. In essence, I'd only really be avoiding having to press a second button, but having to talk to Alexa instead. Interesting idea though. With age typically comes hearing loss, and I can envision that, rather than missing repeated calls to dinner, having someone downstairs turn the task light on and off might be helpful in grabbing my attention.

Once again, thanks all for tossing ideas around ...
 
Old 09-19-2021, 11:25 AM   #8
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 244

Original Poster
Rep: Reputation: Disabled
I received the device suggested by michaelk and - bottom line - my USB task light now turns off when the monitor display times out and life is better! So thanks to michaelk for that. A couple BUTs should be added for those who have an interest though.

BUT #1: the spacing between the AC outlets on the strip is standard AC outlet spacing, i.e. 1.1" between outlets.
Unfortunately, AC to USB adapters are at least 1.2" wide, so multiple plugs can't be used side by side. For this particular device, that means ony one "always on" AC outlet, and only two "switched" outlets are available. As it happens, I have a 2-way adapter that's 1.25" wide, so things are set for the moment.

BUT #2: the threshhold adjustment for this particular device is a bit fiddly and near the limits of its range. This is not a surprise, since its intent is to track power being pulled by heftier devices than a simple monitor, like an actual television or a whole PC. Making the adjustment, while not at all difficult, requires patience while waiting to confirm that everything works when the monitor display is turned off and back on. The GUI used by Cinnamon, for instance, doesn't permit setting the time-out any lower than 5 minutes, so I used the command line as follows:

Code:
 gsettings set org.cinnamon.settings-daemon.plugins.power sleep-display-ac 20
where the 20 at the end is the number of seconds - sufficient time to wait and see if everything was working correctly after each slight turn of the adjustment screw. Of course, the actual Schema[Path] name would depend on what desktop you're using. If you have the dconf editor installed, that's also an option.

This timeout value can be returned to a more typical setting by replacing 20 (or whatever you chose) with something more realistic when you've got things set. Five minutes would be 300 seconds (5 x 60) for example.

BUT #3: the particular model of power strip I received is evidently a slightly newer version than michaelk described. Unlike the Amazon description, the one I received no longer has a master power on/off switch (though the accompanying manual still mentions one). My preference would be to have the ability to shut down everything when the local weather mavens forecast storms that our power company has historically been less than capable of handling, but it's not a show-stopper. Its actual power cord is also a bit shorter than I would have liked but, again, this may or may not be of interest.

Observing the time out in action is rather fascinating (if you're easily amused), and speaks to the sensitivity of the adjustments on the power strip. As the desktop goes dark, the USB task light and a separate AC lamp I added for testing go dark a few seconds later. After a few seconds, the Monitor sees fit to display an on screen message to inform me that there is "[No Signal]," which of course turns the lights back on momentarily until the message disappears. Quite a production, and perfectly understandable, if initially disconcerting.

BUT #4: It's 2021; I've been fiddling with computers since the Univac 1004 back in the mid-1960s, and believe that by now the backlighting on my keyboard should turn off when the monitor goes dark so I don't have to remember to do so. The keyboard's USB connection can't be connected in the same manner as the task light, so I've attached a two page pdf outlining what I believe would be a practical and cost-effective approach Monitor and Hub manufacturers might take to accomplish this. Please feel free to share this with any monitor manufacturers you might run across...

So again, thanks for the comments and feedback. I'd love to hear any other suggestions or thoughts on this subject anyone may have.

Stay safe ...
Attached Files
File Type: pdf USB-Power-Control.pdf (272.4 KB, 7 views)
 
  


Reply

Tags
power management, usb


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Screen power off doesn't power off GPU Geremia Slackware 8 04-27-2021 07:39 PM
Display not turning off when using xrandr --output <display> --off. Instead it just turns black. bluesk Linux - Newbie 5 07-18-2020 10:24 AM
Turning off wireless power management in wlan0 rc.wireless.conf is ignored vharishankar Slackware 8 09-24-2012 11:39 AM
Power off USB storage device/port to avoid power consumption johndir Linux - Hardware 4 11-15-2011 05:04 PM
What "kernel opts" allow PC to power down with "turning energy off"? kornerr Linux - General 1 03-10-2005 12:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 11:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration