So, being the proud owner of a 12 core Mac Pro (2013 model), I ran into the problem that the backlights of my keyboard (Havit - highly recommend their low profile mechanical keyboard) and mouse (Logitech) remained on during sleep mode.
It took quite a bit of searching, until I found this post at SuperUser.com which pointed me in the right direction.
It appeared however that pretty much only the values 0, 3 and 25 (!) are valid for my Mac Pro.
Here my own findings and fix:
On your Mac model / macOS version, type "man pmset" in Terminal to see what the values are for your Mac - seems not all models and/or macOS versions adhere to the same numbering scheme. The variable hibernatemode supports values of 0, 3, or 25.
hibernatemode = 0 default on desktops. The system will not back memory up to persistent storage. The system must wake from the contents of memory; the system will lose context on power loss. This is, historically, plain old sleep.
hibernatemode = 3 default on portables. The system will store a copy of memory to persistent storage (the disk), and will power memory during sleep. The system will wake from memory, unless a power loss forces it to restore from hibernate image.
hibernatemode = 25 is only settable via pmset. The system will store a copy of memory to persistent storage (the disk), and will remove power to memory. The system will restore from disk image. If you want "hibernation" - slower sleeps, slower wakes, and better battery life, you should use this setting.
On my MacPro (2013 model) both values 3 and 25 will power down the backlight of my (non-Apple) mouse (Logitech) and keyboard (Havit). The default settings would keep the backlights on - which can be quite annoying.
Boot time (64Gb RAM) with "hibernatemode = 3" is very fast, "hibernatemode = 25" only a fraction slower.
How to set the value:
sudo pmset -a hibernatemode 3
sudo pmset -a hibernatemode 25
(I recommend value 3)
From the SuperUSer.com post:
According to Apple Computers and Displays: Powering peripherals through USB the only way to turn off power to the USB ports is to turn off the Mac, power will remain while the Mac is sleeping. If your Apple computer or display is powered off, no power will be provided.
A work around for this is changing what your Mac Does when you close the lid. You can reconfigure your MacBook to go into a different safe sleep mode when you close the lid, as opposed to normal sleep. This is very similar to the hibernate feature available for Windows PC and would result in USB power being off.
The only con is that you would have to press the power button to start your mac when you open it. And it would take more time to get the Mac back to where you left off at, as it reloads the contents of RAM from disk.
You can change your Macs sleep-mode as indicated in Set newer portable Macs' sleep mode provided by MacWorld.
Check the current setup
$ pmset -g | grep hibernatemode
which mode is which:
0 - Old style sleep mode, with RAM powered on while sleeping, safe sleep disabled, and super-fast wake.
1 - Hibernation mode, with RAM contents written to disk, system totally shut down while “sleeping,” and slower wake up, due to reading the contents of RAM off the hard drive.
3 - The default mode on machines introduced since about fall 2005. RAM is powered on while sleeping, but RAM contents are also written to disk before sleeping. In the event of total power loss, the system enters hibernation mode automatically.
5 - This is the same as mode 1, but it’s for those using secure virtual memory (in System Preferences -> Security).
7 - This is the same as mode 3, but it’s for those using secure virtual memory.
Change the sleep mode setting
sudo pmset -a hibernatemode 1