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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
09-10-2021, 10:43 AM
|
#1
|
Member
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 244
Rep: 
|
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.
|
|
|
09-10-2021, 03:21 PM
|
#2
|
Moderator
Registered: Aug 2002
Posts: 26,731
|
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.
|
|
|
09-10-2021, 06:28 PM
|
#3
|
Member
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 244
Original Poster
Rep: 
|
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.
|
|
|
09-11-2021, 04:00 AM
|
#5
|
LQ Addict
Registered: Dec 2013
Posts: 19,872
|
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.
|
|
|
09-12-2021, 09:40 AM
|
#6
|
Moderator
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,976
|
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!

|
|
|
09-12-2021, 10:44 AM
|
#7
|
Member
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 244
Original Poster
Rep: 
|
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 ...
|
|
|
09-19-2021, 11:25 AM
|
#8
|
Member
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 244
Original Poster
Rep: 
|
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 ...
|
|
|
All times are GMT -5. The time now is 11:33 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|