How to turn off the USB power to my mouse, when I suspend the notebook?How to disable auto power off of usb devices like usb mouse?How can I turn off power to USB port?how to make my Bluetooth USB adapter suspend, when my laptop suspendsSet webcam on different USB bus/dev/ttyUSB0 doesn't existsHow can I get iball usb tv tuner card to work?WIFI USB adapter - Sitecom WLA-3001 AC450 instalationOn-board USB ports are not working but front case ports areI am unable to detect or mount my usb sticks (Ubuntu 16.04)External usb mouse and keyboard stop working all of a suddenUSB ports undetected by Ubuntu 16.04I built a PC with a hard drive from an old system, and now my TP Link Archer T4U USB isn't working properlyMouse clicks caused by Arduino device

When were linguistics departments first established

US to Europe trip with Canada layover- is 52 minutes enough?

What Happens when Passenger Refuses to Fly Boeing 737 Max?

Why does Deadpool say "You're welcome, Canada," after shooting Ryan Reynolds in the end credits?

How do anti-virus programs start at Windows boot?

Potentiometer like component

Does Linux have system calls to access all the features of the file systems it supports?

What is the blue range indicating on this manifold pressure gauge?

How can I discourage/prevent PCs from using door choke-points?

Replacing Windows 7 security updates with anti-virus?

What happens with multiple copies of Humility and Glorious Anthem on the battlefield?

Single word request: Harming the benefactor

Is it true that real estate prices mainly go up?

Counter-example to the existence of left Bousfield localization of combinatorial model category

Force user to remove USB token

How to deal with a cynical class?

Touchscreen-controlled dentist office snowman collector game

Best mythical creature to use as livestock?

"However" used in a conditional clause?

Does the Bracer of Flying Daggers benefit from the Dueling Fighting style?

How does Dispel Magic work against Stoneskin?

Silly Sally's Movie

Prove that the total distance is minimised (when travelling across the longest path)

Is King K. Rool's down throw to up-special a true combo?



How to turn off the USB power to my mouse, when I suspend the notebook?


How to disable auto power off of usb devices like usb mouse?How can I turn off power to USB port?how to make my Bluetooth USB adapter suspend, when my laptop suspendsSet webcam on different USB bus/dev/ttyUSB0 doesn't existsHow can I get iball usb tv tuner card to work?WIFI USB adapter - Sitecom WLA-3001 AC450 instalationOn-board USB ports are not working but front case ports areI am unable to detect or mount my usb sticks (Ubuntu 16.04)External usb mouse and keyboard stop working all of a suddenUSB ports undetected by Ubuntu 16.04I built a PC with a hard drive from an old system, and now my TP Link Archer T4U USB isn't working properlyMouse clicks caused by Arduino device













18















The LED light of my mouse gets on my nerves when sleeping. I usually close my notebook in the evening and Ubuntu calls pm-suspend. Anyways, the USB plug is still served with power. I could even charge my smartphone. This is bad for me for two reasons. I have to unplug my mouse and the notebook battery pack [akku] lasts less. Is there a way to automatically power off my USB device, or all USB devices, when the notebook goes into suspend mode?



How to configure it?



EDIT: As requested in the comments, I add this information: I am using a Lenovo G550.



EDIT: As requested here my lsusb output



Bus 002 Device 019: ID 1058:25a3 Western Digital Technologies, Inc. 
Bus 002 Device 017: ID 1b1a:7001
Bus 002 Device 009: ID 2109:2812 VIA Labs, Inc. VL812 Hub
Bus 002 Device 008: ID 2109:2812 VIA Labs, Inc. VL812 Hub
Bus 002 Device 003: ID 0402:5608 ALi Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 006: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


EDIT: I think this information also leads to the answer.



root@localhost:/sys/bus/usb/devices# ls -al
insgesamt 0
drwxr-xr-x 2 root root 0 Okt 6 10:56 .
drwxr-xr-x 4 root root 0 Okt 6 10:56 ..
lrwxrwxrwx 1 root root 0 Okt 6 10:56 1-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.7/usb1/1-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-3 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-3
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-3:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-3/2-3:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-3:1.1 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-3/2-3:1.1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1/2-5.1:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1.2 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1/2-5.1.2
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1.2:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1/2-5.1.2/2-5.1.2:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1.2:1.1 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1/2-5.1.2/2-5.1.2:1.1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.2 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.2
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.2:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.2/2-5.2:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 3-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3/3-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 4-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.1/usb4/4-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 5-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.2/usb5/5-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-1 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-1:1.0 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-1:1.1 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-1:1.2 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.2
lrwxrwxrwx 1 root root 0 Okt 6 10:56 7-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.1/usb7/7-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 8-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.2/usb8/8-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb1 -> ../../../devices/pci0000:00/0000:00:1a.7/usb1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb2 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb3 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb4 -> ../../../devices/pci0000:00/0000:00:1a.1/usb4
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb5 -> ../../../devices/pci0000:00/0000:00:1a.2/usb5
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb6 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb7 -> ../../../devices/pci0000:00/0000:00:1d.1/usb7
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb8 -> ../../../devices/pci0000:00/0000:00:1d.2/usb8


EDIT:



tokam@localhost:~$ lsusb -t
/: Bus 08.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
|__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 1: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 1: Dev 2, If 2, Class=Human Interface Device, Driver=usbhid, 12M
/: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
|__ Port 3: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 3: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
|__ Port 5: Dev 51, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 1: Dev 52, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 2: Dev 54, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 2: Dev 54, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 2: Dev 53, If 0, Class=Mass Storage, Driver=usb-storage, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M









share|improve this question



















  • 8





    I don't think this sleep charge feature is something to do with Ubuntu. Windows and Ubuntu do it for me on my laptop. Instead, there should be a setting in BIOS to turn off power to the USB ports during sleep.

    – TheWanderer
    Sep 10 '16 at 13:52






  • 1





    Are you sure? Google showed me some information for the keyword "usb suspend ubuntu". But I am not yet 100% sure how to do it right. hamwaves.com/usb.autosuspend/en askubuntu.com/questions/80638/…

    – tokam
    Sep 10 '16 at 14:19






  • 1





    Well you can disable them, but that's while Ubuntu itself is running. If you want to make scripts to run before the laptop sleeps to suspend the ports, it's possible, but it's going to be easier to at least check your BIOS settings for that option.

    – TheWanderer
    Sep 10 '16 at 14:21






  • 1





    My BIOS unfortunately does not support such an option.

    – tokam
    Sep 12 '16 at 10:05






  • 1





    @tokam, could you edit question and add the brand and model of the laptop? Also could you confirm that it is not a USB power-share port as explained here: dell.com/support/article/ro/ro/robsdt1/SLN155147/EN (lightning bolt icon)

    – user.dz
    Sep 27 '16 at 10:53
















18















The LED light of my mouse gets on my nerves when sleeping. I usually close my notebook in the evening and Ubuntu calls pm-suspend. Anyways, the USB plug is still served with power. I could even charge my smartphone. This is bad for me for two reasons. I have to unplug my mouse and the notebook battery pack [akku] lasts less. Is there a way to automatically power off my USB device, or all USB devices, when the notebook goes into suspend mode?



How to configure it?



EDIT: As requested in the comments, I add this information: I am using a Lenovo G550.



EDIT: As requested here my lsusb output



Bus 002 Device 019: ID 1058:25a3 Western Digital Technologies, Inc. 
Bus 002 Device 017: ID 1b1a:7001
Bus 002 Device 009: ID 2109:2812 VIA Labs, Inc. VL812 Hub
Bus 002 Device 008: ID 2109:2812 VIA Labs, Inc. VL812 Hub
Bus 002 Device 003: ID 0402:5608 ALi Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 006: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


EDIT: I think this information also leads to the answer.



root@localhost:/sys/bus/usb/devices# ls -al
insgesamt 0
drwxr-xr-x 2 root root 0 Okt 6 10:56 .
drwxr-xr-x 4 root root 0 Okt 6 10:56 ..
lrwxrwxrwx 1 root root 0 Okt 6 10:56 1-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.7/usb1/1-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-3 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-3
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-3:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-3/2-3:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-3:1.1 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-3/2-3:1.1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1/2-5.1:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1.2 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1/2-5.1.2
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1.2:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1/2-5.1.2/2-5.1.2:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1.2:1.1 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1/2-5.1.2/2-5.1.2:1.1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.2 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.2
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.2:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.2/2-5.2:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 3-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3/3-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 4-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.1/usb4/4-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 5-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.2/usb5/5-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-1 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-1:1.0 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-1:1.1 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-1:1.2 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.2
lrwxrwxrwx 1 root root 0 Okt 6 10:56 7-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.1/usb7/7-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 8-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.2/usb8/8-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb1 -> ../../../devices/pci0000:00/0000:00:1a.7/usb1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb2 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb3 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb4 -> ../../../devices/pci0000:00/0000:00:1a.1/usb4
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb5 -> ../../../devices/pci0000:00/0000:00:1a.2/usb5
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb6 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb7 -> ../../../devices/pci0000:00/0000:00:1d.1/usb7
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb8 -> ../../../devices/pci0000:00/0000:00:1d.2/usb8


EDIT:



tokam@localhost:~$ lsusb -t
/: Bus 08.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
|__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 1: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 1: Dev 2, If 2, Class=Human Interface Device, Driver=usbhid, 12M
/: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
|__ Port 3: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 3: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
|__ Port 5: Dev 51, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 1: Dev 52, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 2: Dev 54, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 2: Dev 54, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 2: Dev 53, If 0, Class=Mass Storage, Driver=usb-storage, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M









share|improve this question



















  • 8





    I don't think this sleep charge feature is something to do with Ubuntu. Windows and Ubuntu do it for me on my laptop. Instead, there should be a setting in BIOS to turn off power to the USB ports during sleep.

    – TheWanderer
    Sep 10 '16 at 13:52






  • 1





    Are you sure? Google showed me some information for the keyword "usb suspend ubuntu". But I am not yet 100% sure how to do it right. hamwaves.com/usb.autosuspend/en askubuntu.com/questions/80638/…

    – tokam
    Sep 10 '16 at 14:19






  • 1





    Well you can disable them, but that's while Ubuntu itself is running. If you want to make scripts to run before the laptop sleeps to suspend the ports, it's possible, but it's going to be easier to at least check your BIOS settings for that option.

    – TheWanderer
    Sep 10 '16 at 14:21






  • 1





    My BIOS unfortunately does not support such an option.

    – tokam
    Sep 12 '16 at 10:05






  • 1





    @tokam, could you edit question and add the brand and model of the laptop? Also could you confirm that it is not a USB power-share port as explained here: dell.com/support/article/ro/ro/robsdt1/SLN155147/EN (lightning bolt icon)

    – user.dz
    Sep 27 '16 at 10:53














18












18








18


3






The LED light of my mouse gets on my nerves when sleeping. I usually close my notebook in the evening and Ubuntu calls pm-suspend. Anyways, the USB plug is still served with power. I could even charge my smartphone. This is bad for me for two reasons. I have to unplug my mouse and the notebook battery pack [akku] lasts less. Is there a way to automatically power off my USB device, or all USB devices, when the notebook goes into suspend mode?



How to configure it?



EDIT: As requested in the comments, I add this information: I am using a Lenovo G550.



EDIT: As requested here my lsusb output



Bus 002 Device 019: ID 1058:25a3 Western Digital Technologies, Inc. 
Bus 002 Device 017: ID 1b1a:7001
Bus 002 Device 009: ID 2109:2812 VIA Labs, Inc. VL812 Hub
Bus 002 Device 008: ID 2109:2812 VIA Labs, Inc. VL812 Hub
Bus 002 Device 003: ID 0402:5608 ALi Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 006: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


EDIT: I think this information also leads to the answer.



root@localhost:/sys/bus/usb/devices# ls -al
insgesamt 0
drwxr-xr-x 2 root root 0 Okt 6 10:56 .
drwxr-xr-x 4 root root 0 Okt 6 10:56 ..
lrwxrwxrwx 1 root root 0 Okt 6 10:56 1-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.7/usb1/1-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-3 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-3
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-3:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-3/2-3:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-3:1.1 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-3/2-3:1.1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1/2-5.1:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1.2 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1/2-5.1.2
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1.2:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1/2-5.1.2/2-5.1.2:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1.2:1.1 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1/2-5.1.2/2-5.1.2:1.1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.2 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.2
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.2:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.2/2-5.2:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 3-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3/3-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 4-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.1/usb4/4-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 5-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.2/usb5/5-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-1 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-1:1.0 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-1:1.1 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-1:1.2 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.2
lrwxrwxrwx 1 root root 0 Okt 6 10:56 7-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.1/usb7/7-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 8-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.2/usb8/8-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb1 -> ../../../devices/pci0000:00/0000:00:1a.7/usb1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb2 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb3 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb4 -> ../../../devices/pci0000:00/0000:00:1a.1/usb4
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb5 -> ../../../devices/pci0000:00/0000:00:1a.2/usb5
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb6 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb7 -> ../../../devices/pci0000:00/0000:00:1d.1/usb7
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb8 -> ../../../devices/pci0000:00/0000:00:1d.2/usb8


EDIT:



tokam@localhost:~$ lsusb -t
/: Bus 08.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
|__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 1: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 1: Dev 2, If 2, Class=Human Interface Device, Driver=usbhid, 12M
/: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
|__ Port 3: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 3: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
|__ Port 5: Dev 51, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 1: Dev 52, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 2: Dev 54, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 2: Dev 54, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 2: Dev 53, If 0, Class=Mass Storage, Driver=usb-storage, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M









share|improve this question
















The LED light of my mouse gets on my nerves when sleeping. I usually close my notebook in the evening and Ubuntu calls pm-suspend. Anyways, the USB plug is still served with power. I could even charge my smartphone. This is bad for me for two reasons. I have to unplug my mouse and the notebook battery pack [akku] lasts less. Is there a way to automatically power off my USB device, or all USB devices, when the notebook goes into suspend mode?



How to configure it?



EDIT: As requested in the comments, I add this information: I am using a Lenovo G550.



EDIT: As requested here my lsusb output



Bus 002 Device 019: ID 1058:25a3 Western Digital Technologies, Inc. 
Bus 002 Device 017: ID 1b1a:7001
Bus 002 Device 009: ID 2109:2812 VIA Labs, Inc. VL812 Hub
Bus 002 Device 008: ID 2109:2812 VIA Labs, Inc. VL812 Hub
Bus 002 Device 003: ID 0402:5608 ALi Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 006: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


EDIT: I think this information also leads to the answer.



root@localhost:/sys/bus/usb/devices# ls -al
insgesamt 0
drwxr-xr-x 2 root root 0 Okt 6 10:56 .
drwxr-xr-x 4 root root 0 Okt 6 10:56 ..
lrwxrwxrwx 1 root root 0 Okt 6 10:56 1-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.7/usb1/1-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-3 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-3
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-3:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-3/2-3:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-3:1.1 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-3/2-3:1.1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1/2-5.1:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1.2 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1/2-5.1.2
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1.2:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1/2-5.1.2/2-5.1.2:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.1.2:1.1 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1/2-5.1.2/2-5.1.2:1.1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.2 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.2
lrwxrwxrwx 1 root root 0 Okt 6 10:56 2-5.2:1.0 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.2/2-5.2:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 3-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3/3-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 4-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.1/usb4/4-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 5-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.2/usb5/5-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-1 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-1:1.0 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-1:1.1 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 6-1:1.2 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.2
lrwxrwxrwx 1 root root 0 Okt 6 10:56 7-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.1/usb7/7-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 8-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.2/usb8/8-0:1.0
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb1 -> ../../../devices/pci0000:00/0000:00:1a.7/usb1
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb2 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb3 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb4 -> ../../../devices/pci0000:00/0000:00:1a.1/usb4
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb5 -> ../../../devices/pci0000:00/0000:00:1a.2/usb5
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb6 -> ../../../devices/pci0000:00/0000:00:1d.0/usb6
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb7 -> ../../../devices/pci0000:00/0000:00:1d.1/usb7
lrwxrwxrwx 1 root root 0 Okt 6 10:56 usb8 -> ../../../devices/pci0000:00/0000:00:1d.2/usb8


EDIT:



tokam@localhost:~$ lsusb -t
/: Bus 08.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
|__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 1: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 1: Dev 2, If 2, Class=Human Interface Device, Driver=usbhid, 12M
/: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
|__ Port 3: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 3: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
|__ Port 5: Dev 51, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 1: Dev 52, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 2: Dev 54, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 2: Dev 54, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 2: Dev 53, If 0, Class=Mass Storage, Driver=usb-storage, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M






usb kernel mouse suspend power-management






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 13 '16 at 19:48









Carolus

181113




181113










asked Sep 10 '16 at 13:40









tokamtokam

13713




13713







  • 8





    I don't think this sleep charge feature is something to do with Ubuntu. Windows and Ubuntu do it for me on my laptop. Instead, there should be a setting in BIOS to turn off power to the USB ports during sleep.

    – TheWanderer
    Sep 10 '16 at 13:52






  • 1





    Are you sure? Google showed me some information for the keyword "usb suspend ubuntu". But I am not yet 100% sure how to do it right. hamwaves.com/usb.autosuspend/en askubuntu.com/questions/80638/…

    – tokam
    Sep 10 '16 at 14:19






  • 1





    Well you can disable them, but that's while Ubuntu itself is running. If you want to make scripts to run before the laptop sleeps to suspend the ports, it's possible, but it's going to be easier to at least check your BIOS settings for that option.

    – TheWanderer
    Sep 10 '16 at 14:21






  • 1





    My BIOS unfortunately does not support such an option.

    – tokam
    Sep 12 '16 at 10:05






  • 1





    @tokam, could you edit question and add the brand and model of the laptop? Also could you confirm that it is not a USB power-share port as explained here: dell.com/support/article/ro/ro/robsdt1/SLN155147/EN (lightning bolt icon)

    – user.dz
    Sep 27 '16 at 10:53













  • 8





    I don't think this sleep charge feature is something to do with Ubuntu. Windows and Ubuntu do it for me on my laptop. Instead, there should be a setting in BIOS to turn off power to the USB ports during sleep.

    – TheWanderer
    Sep 10 '16 at 13:52






  • 1





    Are you sure? Google showed me some information for the keyword "usb suspend ubuntu". But I am not yet 100% sure how to do it right. hamwaves.com/usb.autosuspend/en askubuntu.com/questions/80638/…

    – tokam
    Sep 10 '16 at 14:19






  • 1





    Well you can disable them, but that's while Ubuntu itself is running. If you want to make scripts to run before the laptop sleeps to suspend the ports, it's possible, but it's going to be easier to at least check your BIOS settings for that option.

    – TheWanderer
    Sep 10 '16 at 14:21






  • 1





    My BIOS unfortunately does not support such an option.

    – tokam
    Sep 12 '16 at 10:05






  • 1





    @tokam, could you edit question and add the brand and model of the laptop? Also could you confirm that it is not a USB power-share port as explained here: dell.com/support/article/ro/ro/robsdt1/SLN155147/EN (lightning bolt icon)

    – user.dz
    Sep 27 '16 at 10:53








8




8





I don't think this sleep charge feature is something to do with Ubuntu. Windows and Ubuntu do it for me on my laptop. Instead, there should be a setting in BIOS to turn off power to the USB ports during sleep.

– TheWanderer
Sep 10 '16 at 13:52





I don't think this sleep charge feature is something to do with Ubuntu. Windows and Ubuntu do it for me on my laptop. Instead, there should be a setting in BIOS to turn off power to the USB ports during sleep.

– TheWanderer
Sep 10 '16 at 13:52




1




1





Are you sure? Google showed me some information for the keyword "usb suspend ubuntu". But I am not yet 100% sure how to do it right. hamwaves.com/usb.autosuspend/en askubuntu.com/questions/80638/…

– tokam
Sep 10 '16 at 14:19





Are you sure? Google showed me some information for the keyword "usb suspend ubuntu". But I am not yet 100% sure how to do it right. hamwaves.com/usb.autosuspend/en askubuntu.com/questions/80638/…

– tokam
Sep 10 '16 at 14:19




1




1





Well you can disable them, but that's while Ubuntu itself is running. If you want to make scripts to run before the laptop sleeps to suspend the ports, it's possible, but it's going to be easier to at least check your BIOS settings for that option.

– TheWanderer
Sep 10 '16 at 14:21





Well you can disable them, but that's while Ubuntu itself is running. If you want to make scripts to run before the laptop sleeps to suspend the ports, it's possible, but it's going to be easier to at least check your BIOS settings for that option.

– TheWanderer
Sep 10 '16 at 14:21




1




1





My BIOS unfortunately does not support such an option.

– tokam
Sep 12 '16 at 10:05





My BIOS unfortunately does not support such an option.

– tokam
Sep 12 '16 at 10:05




1




1





@tokam, could you edit question and add the brand and model of the laptop? Also could you confirm that it is not a USB power-share port as explained here: dell.com/support/article/ro/ro/robsdt1/SLN155147/EN (lightning bolt icon)

– user.dz
Sep 27 '16 at 10:53






@tokam, could you edit question and add the brand and model of the laptop? Also could you confirm that it is not a USB power-share port as explained here: dell.com/support/article/ro/ro/robsdt1/SLN155147/EN (lightning bolt icon)

– user.dz
Sep 27 '16 at 10:53











2 Answers
2






active

oldest

votes


















4





+50











The current stumbling block with OP links, follow up comments and proposed answers is the product ID is static 1b1a:7001 but the Bus and Device numbers keep changing.



The solution



Create a script (any name you want) in the directory /etc/pm/sleep.d/ and place the following in it:



#!/bin/bash
ZeroBUS=$(lsusb | grep 1b1a:7001 | cut -c 5-7 )

# Strip leading zeros
BUS=$(echo $ZeroBUS | sed 's/^0*//')

# Build "usbX" usb number
USB=usb$BUS

case $1 in
suspend|suspend_hybrid|hibernate)
echo "Powering off: " $USB
echo $USB | sudo tee /sys/bus/usb/drivers/usb/unbind
;;
resume|thaw)
# No need to do anything here, kernel unsuspends USB devices
# Show how to power on for interest sake but since device is
# powered off the usb number will be blank.
echo "Powering on: " $USB
echo $USB | sudo tee /sys/bus/usb/drivers/usb/bind
;;
esac


Mark the file as executable with sudo chmod +x file_name where "file_name" is the name you chose.



The explanation



This solution powers off the entire USB hub which in my case meant phone, wireless mouse, wireless keyboard, etc. When calling the script from terminal prompt the sudo password needs to be entered. Hopefully when called from systemd sudo powers are inherited. I could not test this though because I don't have a wired mouse. Therefore additional refinement may be necessary for sudo powers.



The power isn't physically cut when the BIOS is providing constant 5V power supply, rather the devices on the bus are told to turn themselves off. In my case the wireless keyboard and mouse stopped working and had to resort to laptop keyboard and touchpad to return power back on.



You can test this manually by calling the script and passing the parameters "suspend". Passing the parameter "resume" accomplishes nothing because the device is powered off it has no device ID to turn it back on.




Easier solution power off all USB ports



I recently ran into a problem where an unknown port was preventing laptop from suspending. I found this solution (credit in code) which I modified.



Create the file /lib/systemd/system-sleep/custom-xhci_hcd using sudo powers and insert this code:



#!/bin/bash

# Original script was using /bin/sh but shellcheck reporting warnings.

# NAME: custom-xhci_hcd
# PATH: /lib/systemd/system-sleep
# CALL: Called from SystemD automatically
# DESC: Suspend broken for USB3.0 as of Oct 25/2018 various kernels all at once

# DATE: Oct 28 2018.

# NOTE: From comment #61 at: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/522998

TMPLIST=/tmp/xhci-dev-list

# Original script was: case "$1" in hibernate|suspend)

case $1/$2 in
pre/*)
echo "$0: Going to $2..."
echo -n '' > $TMPLIST
for i in `ls /sys/bus/pci/drivers/xhci_hcd/ | egrep '[0-9a-z]+:[0-9a-z]+:.*$'`; do
# Unbind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/pci/drivers/xhci_hcd/unbind
echo "$i" >> $TMPLIST
done
;;
post/*)
echo "$0: Waking up from $2..."
for i in `cat $TMPLIST`; do
# Bind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/pci/drivers/xhci_hcd/bind
done
rm $TMPLIST
;;
esac





share|improve this answer

























  • Can I test the script somehow before actually suspending the notebook with an non dynamic echo command?

    – tokam
    Oct 16 '16 at 7:41











  • you were able to successfully isolate the bus and device which is also shown in lsusb, but as you pointed out the directory does not exist, as shown in the question, the directories have a different structure than $BUS-$DEVICE, and I am not sure if even with knowing which one is the right one the suspending works

    – tokam
    Oct 16 '16 at 7:43












  • A test in which I unplugged and replugged the mouse helped to identify the folder. But look at the output of the next test: Keine Berechtigung means: no permission root@localhost:~# echo suspend > /sys/bus/usb/devices/2-5.1.2:1.1/power/level -bash: /sys/bus/usb/devices/2-5.1.2:1.1/power/level: Keine Berechtigung

    – tokam
    Oct 16 '16 at 7:47











  • The mouse has an LED at thouse outside and a laser at the bottom. With a combination of both answers provided, I was able to turn the laser of the mouse off, but not the LED, which adds light no my sleeping environment. Maybe we can not turn the LED off by the Kernel? I tested it on an isolated USB Plug for the mouse.

    – tokam
    Oct 16 '16 at 7:58












  • @tokam After a lot of research and testing I finally got it to work on my system manually but do not have your mouse to test it. Hopefully it works!

    – WinEunuuchs2Unix
    Oct 16 '16 at 13:57


















5














Find the bus and device # of your mouse by issuing the command lsusb (with and without it plugged in) you want the one that's only there when it's plugged in. Make a note of the numbers. In your case they appear to be 6 and 6



issue the command sudo cp /etc/pm/sleep.d/novatel_3g_suspend /etc/pm/sleep.d/mouse_suspend (we have to do this because gedit no longer has a Save As option when launched as superuser that I can find.)



issue the command gksu gedit /etc/pm/sleep.d/mouse_suspend Change the Bus and Device numbers to match the ones you took note of earlier. Save the resulting file. It will be executed when you suspend your laptop.



In your case you should change BUS=X and DEVICE=Y to the Bus and Device numbers that match the mouse in question. This will work until you move the device to a different port in which case you will have to locate the device again and adjust the file accordingly.



BUS=X
DEVICE=Y

if [ ! -x /sys/bus/usb/devices/$BUS-$DEVICE/power/level ]; then
exit 0
fi

case $1 in
suspend|suspend_hybrid|hibernate)
echo suspend > /sys/bus/usb/devices/$BUS-$DEVICE/power/level
;;
resume|thaw)
# No need to do anything here, kernel unsuspends USB devices
:
;;
esac


The comments in the file (lines beginning with #) are irrelevant and can be safely ignored.



Note: I tested this via Suspend on a desktop and it worked as advertised. I do not have access to the same hardware you have but I had to resume the system via the power button so I'm fairly certain this will work for you.



Edit based on comments and expansion of question:



It appears that this is the info you need to proceed:
Bus 006 Device 006: ID 046d:c52b Logitech, Inc. Unifying Receiver






share|improve this answer

























  • In my gedit Ubuntu 16.04 vanilla upgrade from 14.04 there is a Save as option under the File menu. Something must have happened to your configuration??? PS good answer, I'll try it later.

    – WinEunuuchs2Unix
    Sep 28 '16 at 11:44












  • I have file save as too, using Ubuntu Mate.

    – tokam
    Sep 29 '16 at 10:34











  • @WinEunuuchs2Unix Interesting. It doesn't appear to exist on a fresh install. Perhaps this is the basis for a new question....

    – Elder Geek
    Sep 29 '16 at 14:26











  • @ElderGeek An update on Save As if I type gedit I get the entire top line menu of "File Edit View Search Tools Documents Help" but if I type gksu gedit the menu list doesn't appear. HTH.

    – WinEunuuchs2Unix
    Oct 1 '16 at 17:22







  • 1





    @tokam Can you update your question with output from lsusb -t and lsusb with all your devices plugged in as you normally use them day-to-day. That might help us visualize the hub and what not.

    – WinEunuuchs2Unix
    Oct 4 '16 at 23:05











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f823318%2fhow-to-turn-off-the-usb-power-to-my-mouse-when-i-suspend-the-notebook%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









4





+50











The current stumbling block with OP links, follow up comments and proposed answers is the product ID is static 1b1a:7001 but the Bus and Device numbers keep changing.



The solution



Create a script (any name you want) in the directory /etc/pm/sleep.d/ and place the following in it:



#!/bin/bash
ZeroBUS=$(lsusb | grep 1b1a:7001 | cut -c 5-7 )

# Strip leading zeros
BUS=$(echo $ZeroBUS | sed 's/^0*//')

# Build "usbX" usb number
USB=usb$BUS

case $1 in
suspend|suspend_hybrid|hibernate)
echo "Powering off: " $USB
echo $USB | sudo tee /sys/bus/usb/drivers/usb/unbind
;;
resume|thaw)
# No need to do anything here, kernel unsuspends USB devices
# Show how to power on for interest sake but since device is
# powered off the usb number will be blank.
echo "Powering on: " $USB
echo $USB | sudo tee /sys/bus/usb/drivers/usb/bind
;;
esac


Mark the file as executable with sudo chmod +x file_name where "file_name" is the name you chose.



The explanation



This solution powers off the entire USB hub which in my case meant phone, wireless mouse, wireless keyboard, etc. When calling the script from terminal prompt the sudo password needs to be entered. Hopefully when called from systemd sudo powers are inherited. I could not test this though because I don't have a wired mouse. Therefore additional refinement may be necessary for sudo powers.



The power isn't physically cut when the BIOS is providing constant 5V power supply, rather the devices on the bus are told to turn themselves off. In my case the wireless keyboard and mouse stopped working and had to resort to laptop keyboard and touchpad to return power back on.



You can test this manually by calling the script and passing the parameters "suspend". Passing the parameter "resume" accomplishes nothing because the device is powered off it has no device ID to turn it back on.




Easier solution power off all USB ports



I recently ran into a problem where an unknown port was preventing laptop from suspending. I found this solution (credit in code) which I modified.



Create the file /lib/systemd/system-sleep/custom-xhci_hcd using sudo powers and insert this code:



#!/bin/bash

# Original script was using /bin/sh but shellcheck reporting warnings.

# NAME: custom-xhci_hcd
# PATH: /lib/systemd/system-sleep
# CALL: Called from SystemD automatically
# DESC: Suspend broken for USB3.0 as of Oct 25/2018 various kernels all at once

# DATE: Oct 28 2018.

# NOTE: From comment #61 at: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/522998

TMPLIST=/tmp/xhci-dev-list

# Original script was: case "$1" in hibernate|suspend)

case $1/$2 in
pre/*)
echo "$0: Going to $2..."
echo -n '' > $TMPLIST
for i in `ls /sys/bus/pci/drivers/xhci_hcd/ | egrep '[0-9a-z]+:[0-9a-z]+:.*$'`; do
# Unbind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/pci/drivers/xhci_hcd/unbind
echo "$i" >> $TMPLIST
done
;;
post/*)
echo "$0: Waking up from $2..."
for i in `cat $TMPLIST`; do
# Bind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/pci/drivers/xhci_hcd/bind
done
rm $TMPLIST
;;
esac





share|improve this answer

























  • Can I test the script somehow before actually suspending the notebook with an non dynamic echo command?

    – tokam
    Oct 16 '16 at 7:41











  • you were able to successfully isolate the bus and device which is also shown in lsusb, but as you pointed out the directory does not exist, as shown in the question, the directories have a different structure than $BUS-$DEVICE, and I am not sure if even with knowing which one is the right one the suspending works

    – tokam
    Oct 16 '16 at 7:43












  • A test in which I unplugged and replugged the mouse helped to identify the folder. But look at the output of the next test: Keine Berechtigung means: no permission root@localhost:~# echo suspend > /sys/bus/usb/devices/2-5.1.2:1.1/power/level -bash: /sys/bus/usb/devices/2-5.1.2:1.1/power/level: Keine Berechtigung

    – tokam
    Oct 16 '16 at 7:47











  • The mouse has an LED at thouse outside and a laser at the bottom. With a combination of both answers provided, I was able to turn the laser of the mouse off, but not the LED, which adds light no my sleeping environment. Maybe we can not turn the LED off by the Kernel? I tested it on an isolated USB Plug for the mouse.

    – tokam
    Oct 16 '16 at 7:58












  • @tokam After a lot of research and testing I finally got it to work on my system manually but do not have your mouse to test it. Hopefully it works!

    – WinEunuuchs2Unix
    Oct 16 '16 at 13:57















4





+50











The current stumbling block with OP links, follow up comments and proposed answers is the product ID is static 1b1a:7001 but the Bus and Device numbers keep changing.



The solution



Create a script (any name you want) in the directory /etc/pm/sleep.d/ and place the following in it:



#!/bin/bash
ZeroBUS=$(lsusb | grep 1b1a:7001 | cut -c 5-7 )

# Strip leading zeros
BUS=$(echo $ZeroBUS | sed 's/^0*//')

# Build "usbX" usb number
USB=usb$BUS

case $1 in
suspend|suspend_hybrid|hibernate)
echo "Powering off: " $USB
echo $USB | sudo tee /sys/bus/usb/drivers/usb/unbind
;;
resume|thaw)
# No need to do anything here, kernel unsuspends USB devices
# Show how to power on for interest sake but since device is
# powered off the usb number will be blank.
echo "Powering on: " $USB
echo $USB | sudo tee /sys/bus/usb/drivers/usb/bind
;;
esac


Mark the file as executable with sudo chmod +x file_name where "file_name" is the name you chose.



The explanation



This solution powers off the entire USB hub which in my case meant phone, wireless mouse, wireless keyboard, etc. When calling the script from terminal prompt the sudo password needs to be entered. Hopefully when called from systemd sudo powers are inherited. I could not test this though because I don't have a wired mouse. Therefore additional refinement may be necessary for sudo powers.



The power isn't physically cut when the BIOS is providing constant 5V power supply, rather the devices on the bus are told to turn themselves off. In my case the wireless keyboard and mouse stopped working and had to resort to laptop keyboard and touchpad to return power back on.



You can test this manually by calling the script and passing the parameters "suspend". Passing the parameter "resume" accomplishes nothing because the device is powered off it has no device ID to turn it back on.




Easier solution power off all USB ports



I recently ran into a problem where an unknown port was preventing laptop from suspending. I found this solution (credit in code) which I modified.



Create the file /lib/systemd/system-sleep/custom-xhci_hcd using sudo powers and insert this code:



#!/bin/bash

# Original script was using /bin/sh but shellcheck reporting warnings.

# NAME: custom-xhci_hcd
# PATH: /lib/systemd/system-sleep
# CALL: Called from SystemD automatically
# DESC: Suspend broken for USB3.0 as of Oct 25/2018 various kernels all at once

# DATE: Oct 28 2018.

# NOTE: From comment #61 at: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/522998

TMPLIST=/tmp/xhci-dev-list

# Original script was: case "$1" in hibernate|suspend)

case $1/$2 in
pre/*)
echo "$0: Going to $2..."
echo -n '' > $TMPLIST
for i in `ls /sys/bus/pci/drivers/xhci_hcd/ | egrep '[0-9a-z]+:[0-9a-z]+:.*$'`; do
# Unbind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/pci/drivers/xhci_hcd/unbind
echo "$i" >> $TMPLIST
done
;;
post/*)
echo "$0: Waking up from $2..."
for i in `cat $TMPLIST`; do
# Bind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/pci/drivers/xhci_hcd/bind
done
rm $TMPLIST
;;
esac





share|improve this answer

























  • Can I test the script somehow before actually suspending the notebook with an non dynamic echo command?

    – tokam
    Oct 16 '16 at 7:41











  • you were able to successfully isolate the bus and device which is also shown in lsusb, but as you pointed out the directory does not exist, as shown in the question, the directories have a different structure than $BUS-$DEVICE, and I am not sure if even with knowing which one is the right one the suspending works

    – tokam
    Oct 16 '16 at 7:43












  • A test in which I unplugged and replugged the mouse helped to identify the folder. But look at the output of the next test: Keine Berechtigung means: no permission root@localhost:~# echo suspend > /sys/bus/usb/devices/2-5.1.2:1.1/power/level -bash: /sys/bus/usb/devices/2-5.1.2:1.1/power/level: Keine Berechtigung

    – tokam
    Oct 16 '16 at 7:47











  • The mouse has an LED at thouse outside and a laser at the bottom. With a combination of both answers provided, I was able to turn the laser of the mouse off, but not the LED, which adds light no my sleeping environment. Maybe we can not turn the LED off by the Kernel? I tested it on an isolated USB Plug for the mouse.

    – tokam
    Oct 16 '16 at 7:58












  • @tokam After a lot of research and testing I finally got it to work on my system manually but do not have your mouse to test it. Hopefully it works!

    – WinEunuuchs2Unix
    Oct 16 '16 at 13:57













4





+50







4





+50



4




+50







The current stumbling block with OP links, follow up comments and proposed answers is the product ID is static 1b1a:7001 but the Bus and Device numbers keep changing.



The solution



Create a script (any name you want) in the directory /etc/pm/sleep.d/ and place the following in it:



#!/bin/bash
ZeroBUS=$(lsusb | grep 1b1a:7001 | cut -c 5-7 )

# Strip leading zeros
BUS=$(echo $ZeroBUS | sed 's/^0*//')

# Build "usbX" usb number
USB=usb$BUS

case $1 in
suspend|suspend_hybrid|hibernate)
echo "Powering off: " $USB
echo $USB | sudo tee /sys/bus/usb/drivers/usb/unbind
;;
resume|thaw)
# No need to do anything here, kernel unsuspends USB devices
# Show how to power on for interest sake but since device is
# powered off the usb number will be blank.
echo "Powering on: " $USB
echo $USB | sudo tee /sys/bus/usb/drivers/usb/bind
;;
esac


Mark the file as executable with sudo chmod +x file_name where "file_name" is the name you chose.



The explanation



This solution powers off the entire USB hub which in my case meant phone, wireless mouse, wireless keyboard, etc. When calling the script from terminal prompt the sudo password needs to be entered. Hopefully when called from systemd sudo powers are inherited. I could not test this though because I don't have a wired mouse. Therefore additional refinement may be necessary for sudo powers.



The power isn't physically cut when the BIOS is providing constant 5V power supply, rather the devices on the bus are told to turn themselves off. In my case the wireless keyboard and mouse stopped working and had to resort to laptop keyboard and touchpad to return power back on.



You can test this manually by calling the script and passing the parameters "suspend". Passing the parameter "resume" accomplishes nothing because the device is powered off it has no device ID to turn it back on.




Easier solution power off all USB ports



I recently ran into a problem where an unknown port was preventing laptop from suspending. I found this solution (credit in code) which I modified.



Create the file /lib/systemd/system-sleep/custom-xhci_hcd using sudo powers and insert this code:



#!/bin/bash

# Original script was using /bin/sh but shellcheck reporting warnings.

# NAME: custom-xhci_hcd
# PATH: /lib/systemd/system-sleep
# CALL: Called from SystemD automatically
# DESC: Suspend broken for USB3.0 as of Oct 25/2018 various kernels all at once

# DATE: Oct 28 2018.

# NOTE: From comment #61 at: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/522998

TMPLIST=/tmp/xhci-dev-list

# Original script was: case "$1" in hibernate|suspend)

case $1/$2 in
pre/*)
echo "$0: Going to $2..."
echo -n '' > $TMPLIST
for i in `ls /sys/bus/pci/drivers/xhci_hcd/ | egrep '[0-9a-z]+:[0-9a-z]+:.*$'`; do
# Unbind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/pci/drivers/xhci_hcd/unbind
echo "$i" >> $TMPLIST
done
;;
post/*)
echo "$0: Waking up from $2..."
for i in `cat $TMPLIST`; do
# Bind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/pci/drivers/xhci_hcd/bind
done
rm $TMPLIST
;;
esac





share|improve this answer

















The current stumbling block with OP links, follow up comments and proposed answers is the product ID is static 1b1a:7001 but the Bus and Device numbers keep changing.



The solution



Create a script (any name you want) in the directory /etc/pm/sleep.d/ and place the following in it:



#!/bin/bash
ZeroBUS=$(lsusb | grep 1b1a:7001 | cut -c 5-7 )

# Strip leading zeros
BUS=$(echo $ZeroBUS | sed 's/^0*//')

# Build "usbX" usb number
USB=usb$BUS

case $1 in
suspend|suspend_hybrid|hibernate)
echo "Powering off: " $USB
echo $USB | sudo tee /sys/bus/usb/drivers/usb/unbind
;;
resume|thaw)
# No need to do anything here, kernel unsuspends USB devices
# Show how to power on for interest sake but since device is
# powered off the usb number will be blank.
echo "Powering on: " $USB
echo $USB | sudo tee /sys/bus/usb/drivers/usb/bind
;;
esac


Mark the file as executable with sudo chmod +x file_name where "file_name" is the name you chose.



The explanation



This solution powers off the entire USB hub which in my case meant phone, wireless mouse, wireless keyboard, etc. When calling the script from terminal prompt the sudo password needs to be entered. Hopefully when called from systemd sudo powers are inherited. I could not test this though because I don't have a wired mouse. Therefore additional refinement may be necessary for sudo powers.



The power isn't physically cut when the BIOS is providing constant 5V power supply, rather the devices on the bus are told to turn themselves off. In my case the wireless keyboard and mouse stopped working and had to resort to laptop keyboard and touchpad to return power back on.



You can test this manually by calling the script and passing the parameters "suspend". Passing the parameter "resume" accomplishes nothing because the device is powered off it has no device ID to turn it back on.




Easier solution power off all USB ports



I recently ran into a problem where an unknown port was preventing laptop from suspending. I found this solution (credit in code) which I modified.



Create the file /lib/systemd/system-sleep/custom-xhci_hcd using sudo powers and insert this code:



#!/bin/bash

# Original script was using /bin/sh but shellcheck reporting warnings.

# NAME: custom-xhci_hcd
# PATH: /lib/systemd/system-sleep
# CALL: Called from SystemD automatically
# DESC: Suspend broken for USB3.0 as of Oct 25/2018 various kernels all at once

# DATE: Oct 28 2018.

# NOTE: From comment #61 at: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/522998

TMPLIST=/tmp/xhci-dev-list

# Original script was: case "$1" in hibernate|suspend)

case $1/$2 in
pre/*)
echo "$0: Going to $2..."
echo -n '' > $TMPLIST
for i in `ls /sys/bus/pci/drivers/xhci_hcd/ | egrep '[0-9a-z]+:[0-9a-z]+:.*$'`; do
# Unbind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/pci/drivers/xhci_hcd/unbind
echo "$i" >> $TMPLIST
done
;;
post/*)
echo "$0: Waking up from $2..."
for i in `cat $TMPLIST`; do
# Bind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/pci/drivers/xhci_hcd/bind
done
rm $TMPLIST
;;
esac






share|improve this answer














share|improve this answer



share|improve this answer








edited 1 hour ago

























answered Oct 14 '16 at 1:04









WinEunuuchs2UnixWinEunuuchs2Unix

46.6k1190182




46.6k1190182












  • Can I test the script somehow before actually suspending the notebook with an non dynamic echo command?

    – tokam
    Oct 16 '16 at 7:41











  • you were able to successfully isolate the bus and device which is also shown in lsusb, but as you pointed out the directory does not exist, as shown in the question, the directories have a different structure than $BUS-$DEVICE, and I am not sure if even with knowing which one is the right one the suspending works

    – tokam
    Oct 16 '16 at 7:43












  • A test in which I unplugged and replugged the mouse helped to identify the folder. But look at the output of the next test: Keine Berechtigung means: no permission root@localhost:~# echo suspend > /sys/bus/usb/devices/2-5.1.2:1.1/power/level -bash: /sys/bus/usb/devices/2-5.1.2:1.1/power/level: Keine Berechtigung

    – tokam
    Oct 16 '16 at 7:47











  • The mouse has an LED at thouse outside and a laser at the bottom. With a combination of both answers provided, I was able to turn the laser of the mouse off, but not the LED, which adds light no my sleeping environment. Maybe we can not turn the LED off by the Kernel? I tested it on an isolated USB Plug for the mouse.

    – tokam
    Oct 16 '16 at 7:58












  • @tokam After a lot of research and testing I finally got it to work on my system manually but do not have your mouse to test it. Hopefully it works!

    – WinEunuuchs2Unix
    Oct 16 '16 at 13:57

















  • Can I test the script somehow before actually suspending the notebook with an non dynamic echo command?

    – tokam
    Oct 16 '16 at 7:41











  • you were able to successfully isolate the bus and device which is also shown in lsusb, but as you pointed out the directory does not exist, as shown in the question, the directories have a different structure than $BUS-$DEVICE, and I am not sure if even with knowing which one is the right one the suspending works

    – tokam
    Oct 16 '16 at 7:43












  • A test in which I unplugged and replugged the mouse helped to identify the folder. But look at the output of the next test: Keine Berechtigung means: no permission root@localhost:~# echo suspend > /sys/bus/usb/devices/2-5.1.2:1.1/power/level -bash: /sys/bus/usb/devices/2-5.1.2:1.1/power/level: Keine Berechtigung

    – tokam
    Oct 16 '16 at 7:47











  • The mouse has an LED at thouse outside and a laser at the bottom. With a combination of both answers provided, I was able to turn the laser of the mouse off, but not the LED, which adds light no my sleeping environment. Maybe we can not turn the LED off by the Kernel? I tested it on an isolated USB Plug for the mouse.

    – tokam
    Oct 16 '16 at 7:58












  • @tokam After a lot of research and testing I finally got it to work on my system manually but do not have your mouse to test it. Hopefully it works!

    – WinEunuuchs2Unix
    Oct 16 '16 at 13:57
















Can I test the script somehow before actually suspending the notebook with an non dynamic echo command?

– tokam
Oct 16 '16 at 7:41





Can I test the script somehow before actually suspending the notebook with an non dynamic echo command?

– tokam
Oct 16 '16 at 7:41













you were able to successfully isolate the bus and device which is also shown in lsusb, but as you pointed out the directory does not exist, as shown in the question, the directories have a different structure than $BUS-$DEVICE, and I am not sure if even with knowing which one is the right one the suspending works

– tokam
Oct 16 '16 at 7:43






you were able to successfully isolate the bus and device which is also shown in lsusb, but as you pointed out the directory does not exist, as shown in the question, the directories have a different structure than $BUS-$DEVICE, and I am not sure if even with knowing which one is the right one the suspending works

– tokam
Oct 16 '16 at 7:43














A test in which I unplugged and replugged the mouse helped to identify the folder. But look at the output of the next test: Keine Berechtigung means: no permission root@localhost:~# echo suspend > /sys/bus/usb/devices/2-5.1.2:1.1/power/level -bash: /sys/bus/usb/devices/2-5.1.2:1.1/power/level: Keine Berechtigung

– tokam
Oct 16 '16 at 7:47





A test in which I unplugged and replugged the mouse helped to identify the folder. But look at the output of the next test: Keine Berechtigung means: no permission root@localhost:~# echo suspend > /sys/bus/usb/devices/2-5.1.2:1.1/power/level -bash: /sys/bus/usb/devices/2-5.1.2:1.1/power/level: Keine Berechtigung

– tokam
Oct 16 '16 at 7:47













The mouse has an LED at thouse outside and a laser at the bottom. With a combination of both answers provided, I was able to turn the laser of the mouse off, but not the LED, which adds light no my sleeping environment. Maybe we can not turn the LED off by the Kernel? I tested it on an isolated USB Plug for the mouse.

– tokam
Oct 16 '16 at 7:58






The mouse has an LED at thouse outside and a laser at the bottom. With a combination of both answers provided, I was able to turn the laser of the mouse off, but not the LED, which adds light no my sleeping environment. Maybe we can not turn the LED off by the Kernel? I tested it on an isolated USB Plug for the mouse.

– tokam
Oct 16 '16 at 7:58














@tokam After a lot of research and testing I finally got it to work on my system manually but do not have your mouse to test it. Hopefully it works!

– WinEunuuchs2Unix
Oct 16 '16 at 13:57





@tokam After a lot of research and testing I finally got it to work on my system manually but do not have your mouse to test it. Hopefully it works!

– WinEunuuchs2Unix
Oct 16 '16 at 13:57













5














Find the bus and device # of your mouse by issuing the command lsusb (with and without it plugged in) you want the one that's only there when it's plugged in. Make a note of the numbers. In your case they appear to be 6 and 6



issue the command sudo cp /etc/pm/sleep.d/novatel_3g_suspend /etc/pm/sleep.d/mouse_suspend (we have to do this because gedit no longer has a Save As option when launched as superuser that I can find.)



issue the command gksu gedit /etc/pm/sleep.d/mouse_suspend Change the Bus and Device numbers to match the ones you took note of earlier. Save the resulting file. It will be executed when you suspend your laptop.



In your case you should change BUS=X and DEVICE=Y to the Bus and Device numbers that match the mouse in question. This will work until you move the device to a different port in which case you will have to locate the device again and adjust the file accordingly.



BUS=X
DEVICE=Y

if [ ! -x /sys/bus/usb/devices/$BUS-$DEVICE/power/level ]; then
exit 0
fi

case $1 in
suspend|suspend_hybrid|hibernate)
echo suspend > /sys/bus/usb/devices/$BUS-$DEVICE/power/level
;;
resume|thaw)
# No need to do anything here, kernel unsuspends USB devices
:
;;
esac


The comments in the file (lines beginning with #) are irrelevant and can be safely ignored.



Note: I tested this via Suspend on a desktop and it worked as advertised. I do not have access to the same hardware you have but I had to resume the system via the power button so I'm fairly certain this will work for you.



Edit based on comments and expansion of question:



It appears that this is the info you need to proceed:
Bus 006 Device 006: ID 046d:c52b Logitech, Inc. Unifying Receiver






share|improve this answer

























  • In my gedit Ubuntu 16.04 vanilla upgrade from 14.04 there is a Save as option under the File menu. Something must have happened to your configuration??? PS good answer, I'll try it later.

    – WinEunuuchs2Unix
    Sep 28 '16 at 11:44












  • I have file save as too, using Ubuntu Mate.

    – tokam
    Sep 29 '16 at 10:34











  • @WinEunuuchs2Unix Interesting. It doesn't appear to exist on a fresh install. Perhaps this is the basis for a new question....

    – Elder Geek
    Sep 29 '16 at 14:26











  • @ElderGeek An update on Save As if I type gedit I get the entire top line menu of "File Edit View Search Tools Documents Help" but if I type gksu gedit the menu list doesn't appear. HTH.

    – WinEunuuchs2Unix
    Oct 1 '16 at 17:22







  • 1





    @tokam Can you update your question with output from lsusb -t and lsusb with all your devices plugged in as you normally use them day-to-day. That might help us visualize the hub and what not.

    – WinEunuuchs2Unix
    Oct 4 '16 at 23:05
















5














Find the bus and device # of your mouse by issuing the command lsusb (with and without it plugged in) you want the one that's only there when it's plugged in. Make a note of the numbers. In your case they appear to be 6 and 6



issue the command sudo cp /etc/pm/sleep.d/novatel_3g_suspend /etc/pm/sleep.d/mouse_suspend (we have to do this because gedit no longer has a Save As option when launched as superuser that I can find.)



issue the command gksu gedit /etc/pm/sleep.d/mouse_suspend Change the Bus and Device numbers to match the ones you took note of earlier. Save the resulting file. It will be executed when you suspend your laptop.



In your case you should change BUS=X and DEVICE=Y to the Bus and Device numbers that match the mouse in question. This will work until you move the device to a different port in which case you will have to locate the device again and adjust the file accordingly.



BUS=X
DEVICE=Y

if [ ! -x /sys/bus/usb/devices/$BUS-$DEVICE/power/level ]; then
exit 0
fi

case $1 in
suspend|suspend_hybrid|hibernate)
echo suspend > /sys/bus/usb/devices/$BUS-$DEVICE/power/level
;;
resume|thaw)
# No need to do anything here, kernel unsuspends USB devices
:
;;
esac


The comments in the file (lines beginning with #) are irrelevant and can be safely ignored.



Note: I tested this via Suspend on a desktop and it worked as advertised. I do not have access to the same hardware you have but I had to resume the system via the power button so I'm fairly certain this will work for you.



Edit based on comments and expansion of question:



It appears that this is the info you need to proceed:
Bus 006 Device 006: ID 046d:c52b Logitech, Inc. Unifying Receiver






share|improve this answer

























  • In my gedit Ubuntu 16.04 vanilla upgrade from 14.04 there is a Save as option under the File menu. Something must have happened to your configuration??? PS good answer, I'll try it later.

    – WinEunuuchs2Unix
    Sep 28 '16 at 11:44












  • I have file save as too, using Ubuntu Mate.

    – tokam
    Sep 29 '16 at 10:34











  • @WinEunuuchs2Unix Interesting. It doesn't appear to exist on a fresh install. Perhaps this is the basis for a new question....

    – Elder Geek
    Sep 29 '16 at 14:26











  • @ElderGeek An update on Save As if I type gedit I get the entire top line menu of "File Edit View Search Tools Documents Help" but if I type gksu gedit the menu list doesn't appear. HTH.

    – WinEunuuchs2Unix
    Oct 1 '16 at 17:22







  • 1





    @tokam Can you update your question with output from lsusb -t and lsusb with all your devices plugged in as you normally use them day-to-day. That might help us visualize the hub and what not.

    – WinEunuuchs2Unix
    Oct 4 '16 at 23:05














5












5








5







Find the bus and device # of your mouse by issuing the command lsusb (with and without it plugged in) you want the one that's only there when it's plugged in. Make a note of the numbers. In your case they appear to be 6 and 6



issue the command sudo cp /etc/pm/sleep.d/novatel_3g_suspend /etc/pm/sleep.d/mouse_suspend (we have to do this because gedit no longer has a Save As option when launched as superuser that I can find.)



issue the command gksu gedit /etc/pm/sleep.d/mouse_suspend Change the Bus and Device numbers to match the ones you took note of earlier. Save the resulting file. It will be executed when you suspend your laptop.



In your case you should change BUS=X and DEVICE=Y to the Bus and Device numbers that match the mouse in question. This will work until you move the device to a different port in which case you will have to locate the device again and adjust the file accordingly.



BUS=X
DEVICE=Y

if [ ! -x /sys/bus/usb/devices/$BUS-$DEVICE/power/level ]; then
exit 0
fi

case $1 in
suspend|suspend_hybrid|hibernate)
echo suspend > /sys/bus/usb/devices/$BUS-$DEVICE/power/level
;;
resume|thaw)
# No need to do anything here, kernel unsuspends USB devices
:
;;
esac


The comments in the file (lines beginning with #) are irrelevant and can be safely ignored.



Note: I tested this via Suspend on a desktop and it worked as advertised. I do not have access to the same hardware you have but I had to resume the system via the power button so I'm fairly certain this will work for you.



Edit based on comments and expansion of question:



It appears that this is the info you need to proceed:
Bus 006 Device 006: ID 046d:c52b Logitech, Inc. Unifying Receiver






share|improve this answer















Find the bus and device # of your mouse by issuing the command lsusb (with and without it plugged in) you want the one that's only there when it's plugged in. Make a note of the numbers. In your case they appear to be 6 and 6



issue the command sudo cp /etc/pm/sleep.d/novatel_3g_suspend /etc/pm/sleep.d/mouse_suspend (we have to do this because gedit no longer has a Save As option when launched as superuser that I can find.)



issue the command gksu gedit /etc/pm/sleep.d/mouse_suspend Change the Bus and Device numbers to match the ones you took note of earlier. Save the resulting file. It will be executed when you suspend your laptop.



In your case you should change BUS=X and DEVICE=Y to the Bus and Device numbers that match the mouse in question. This will work until you move the device to a different port in which case you will have to locate the device again and adjust the file accordingly.



BUS=X
DEVICE=Y

if [ ! -x /sys/bus/usb/devices/$BUS-$DEVICE/power/level ]; then
exit 0
fi

case $1 in
suspend|suspend_hybrid|hibernate)
echo suspend > /sys/bus/usb/devices/$BUS-$DEVICE/power/level
;;
resume|thaw)
# No need to do anything here, kernel unsuspends USB devices
:
;;
esac


The comments in the file (lines beginning with #) are irrelevant and can be safely ignored.



Note: I tested this via Suspend on a desktop and it worked as advertised. I do not have access to the same hardware you have but I had to resume the system via the power button so I'm fairly certain this will work for you.



Edit based on comments and expansion of question:



It appears that this is the info you need to proceed:
Bus 006 Device 006: ID 046d:c52b Logitech, Inc. Unifying Receiver







share|improve this answer














share|improve this answer



share|improve this answer








edited Oct 16 '16 at 14:21

























answered Sep 27 '16 at 20:09









Elder GeekElder Geek

27.3k954127




27.3k954127












  • In my gedit Ubuntu 16.04 vanilla upgrade from 14.04 there is a Save as option under the File menu. Something must have happened to your configuration??? PS good answer, I'll try it later.

    – WinEunuuchs2Unix
    Sep 28 '16 at 11:44












  • I have file save as too, using Ubuntu Mate.

    – tokam
    Sep 29 '16 at 10:34











  • @WinEunuuchs2Unix Interesting. It doesn't appear to exist on a fresh install. Perhaps this is the basis for a new question....

    – Elder Geek
    Sep 29 '16 at 14:26











  • @ElderGeek An update on Save As if I type gedit I get the entire top line menu of "File Edit View Search Tools Documents Help" but if I type gksu gedit the menu list doesn't appear. HTH.

    – WinEunuuchs2Unix
    Oct 1 '16 at 17:22







  • 1





    @tokam Can you update your question with output from lsusb -t and lsusb with all your devices plugged in as you normally use them day-to-day. That might help us visualize the hub and what not.

    – WinEunuuchs2Unix
    Oct 4 '16 at 23:05


















  • In my gedit Ubuntu 16.04 vanilla upgrade from 14.04 there is a Save as option under the File menu. Something must have happened to your configuration??? PS good answer, I'll try it later.

    – WinEunuuchs2Unix
    Sep 28 '16 at 11:44












  • I have file save as too, using Ubuntu Mate.

    – tokam
    Sep 29 '16 at 10:34











  • @WinEunuuchs2Unix Interesting. It doesn't appear to exist on a fresh install. Perhaps this is the basis for a new question....

    – Elder Geek
    Sep 29 '16 at 14:26











  • @ElderGeek An update on Save As if I type gedit I get the entire top line menu of "File Edit View Search Tools Documents Help" but if I type gksu gedit the menu list doesn't appear. HTH.

    – WinEunuuchs2Unix
    Oct 1 '16 at 17:22







  • 1





    @tokam Can you update your question with output from lsusb -t and lsusb with all your devices plugged in as you normally use them day-to-day. That might help us visualize the hub and what not.

    – WinEunuuchs2Unix
    Oct 4 '16 at 23:05

















In my gedit Ubuntu 16.04 vanilla upgrade from 14.04 there is a Save as option under the File menu. Something must have happened to your configuration??? PS good answer, I'll try it later.

– WinEunuuchs2Unix
Sep 28 '16 at 11:44






In my gedit Ubuntu 16.04 vanilla upgrade from 14.04 there is a Save as option under the File menu. Something must have happened to your configuration??? PS good answer, I'll try it later.

– WinEunuuchs2Unix
Sep 28 '16 at 11:44














I have file save as too, using Ubuntu Mate.

– tokam
Sep 29 '16 at 10:34





I have file save as too, using Ubuntu Mate.

– tokam
Sep 29 '16 at 10:34













@WinEunuuchs2Unix Interesting. It doesn't appear to exist on a fresh install. Perhaps this is the basis for a new question....

– Elder Geek
Sep 29 '16 at 14:26





@WinEunuuchs2Unix Interesting. It doesn't appear to exist on a fresh install. Perhaps this is the basis for a new question....

– Elder Geek
Sep 29 '16 at 14:26













@ElderGeek An update on Save As if I type gedit I get the entire top line menu of "File Edit View Search Tools Documents Help" but if I type gksu gedit the menu list doesn't appear. HTH.

– WinEunuuchs2Unix
Oct 1 '16 at 17:22






@ElderGeek An update on Save As if I type gedit I get the entire top line menu of "File Edit View Search Tools Documents Help" but if I type gksu gedit the menu list doesn't appear. HTH.

– WinEunuuchs2Unix
Oct 1 '16 at 17:22





1




1





@tokam Can you update your question with output from lsusb -t and lsusb with all your devices plugged in as you normally use them day-to-day. That might help us visualize the hub and what not.

– WinEunuuchs2Unix
Oct 4 '16 at 23:05






@tokam Can you update your question with output from lsusb -t and lsusb with all your devices plugged in as you normally use them day-to-day. That might help us visualize the hub and what not.

– WinEunuuchs2Unix
Oct 4 '16 at 23:05


















draft saved

draft discarded
















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f823318%2fhow-to-turn-off-the-usb-power-to-my-mouse-when-i-suspend-the-notebook%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Möglingen Índice Localización Historia Demografía Referencias Enlaces externos Menú de navegación48°53′18″N 9°07′45″E / 48.888333333333, 9.129166666666748°53′18″N 9°07′45″E / 48.888333333333, 9.1291666666667Sitio web oficial Mapa de Möglingen«Gemeinden in Deutschland nach Fläche, Bevölkerung und Postleitzahl am 30.09.2016»Möglingen

Virtualbox - Configuration error: Querying “UUID” failed (VERR_CFGM_VALUE_NOT_FOUND)“VERR_SUPLIB_WORLD_WRITABLE” error when trying to installing OS in virtualboxVirtual Box Kernel errorFailed to open a seesion for the virtual machineFailed to open a session for the virtual machineUbuntu 14.04 LTS Virtualbox errorcan't use VM VirtualBoxusing virtualboxI can't run Linux-64 Bit on VirtualBoxUnable to insert the virtual optical disk (VBoxguestaddition) in virtual machine for ubuntu server in win 10VirtuaBox in Ubuntu 18.04 Issues with Win10.ISO Installation

Antonio De Lisio Carrera Referencias Menú de navegación«Caracas: evolución relacional multipleja»«Cuando los gobiernos subestiman a las localidades: L a Iniciativa para la Integración de la Infraestructura Regional Suramericana (IIRSA) en la frontera Colombo-Venezolana»«Maestría en Planificación Integral del Ambiente»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«Conózcanos»«Caracas: evolución relacional multipleja»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»