Disable USB ports when nothing is playing?

@Bill_Janssen,

Can you do some tests for me?
After booting your unit (with the DAC connected and powered on) show me the output of:

cat /sys/bus/usb/devices/YOUR_DAC/power/control

Where the tricky part is that you need to figure out which directory represents your device.
You can do that the easiest way by figuring out in printing the device manufacturer:

cat /sys/bus/usb/devices/*/manufacturer

And then one of them will show the Topping (I pressume).

Thanks

# cat /sys/bus/usb/devices/1-1.1.2/power/control
auto
# cat /sys/bus/usb/devices/1-1.1.2/manufacturer
Topping

That’s with my /etc/udev/rules.d/usb-power.rules file in place. After I remove it and reboot, I see this:

# cat /sys/bus/usb/devices/1-1.1.2/power/control
on
#

But still it does not work? (With the file in place)

That’s correct. Worked with 2.535, not with 2.566. udev version doesn’t seem to have changed between the two.

Ok, can you try the following (with your udev rules in place):

echo 2 > /sys/bus/usb/devices/1-1.1.2/power/autosuspend

And let me know if it now works.

No, still broken. I do see a difference; the frequency display on the front panel of the DAC now shifts to “-----” (from “44.1”) after the track finishes. But it does not turn off.

I just went back to look at it, and the display was off. Perhaps I hadn’t waited long enough. I’m trying it again. Here’s the power bits when it’s active:

# ls /sys/bus/usb/devices/1-1.1.2/power/
active_duration  autosuspend_delay_ms  control	persist		     runtime_status
autosuspend	 connected_duration    level	runtime_active_time  runtime_suspended_time
# cat /sys/bus/usb/devices/1-1.1.2/power/*
1939030
2
2000
2426800
auto
auto
1
1939070
active
487500
#

Yes, now the display does seem to be turning itself off properly after the track ends.

Here are the bits from the power dir:

   # cat /sys/bus/usb/devices/1-1.1.2/power/*
    1956730
    2
    2000
    2543710
    auto
    auto
    1
    1956770
    suspended
    586710
    #

Ok. So to be clear: it looks that it is now working again as it did before, expect the ‘echo 2 …’ command.

Right?

Affirmative.

Ok clear. Then I understand how it works.

Now the question is how to implement it in an understandable way.

Ideally I make a switch in the ‘advanced’ section labelled something like:

“Enable USB auto suspend”

What do you think?

I think that would be fine.

You might consider a whitelist for devices known to be capable of auto-suspend, to have that switch thrown automatically to “on” for those devices, but that would be more work and possibly a headache.

@Bill_Janssen,

I’ve pushed something to the beta channel, would be great if you can test it.

So, please change to the beta channel (you can do that in the advanced tab).
After the unit is rebooted it will pull in an update (or you need to confirm it manually, depending on your update strategy).

Now please log in, make sure your udev rule is not in place and run the following command:

/opt/RoPieee/lib/enable_usb_auto_suspend

Would be great if you can paste the output of the command.
What it does that it searches for an USB DAC and applies the necessary power settings.

Let me know how this goes.

thanks!

Looks good:

# cat /sys/bus/usb/devices/1-1.1.2/power/*
351290
-1
-1000
351290
on
on
1
350840
active
0
# /opt/RoPieee/lib/enable_usb_auto_suspend
found USB DAC!
  id: 152a:8750
  devpath: /sys/bus/usb/devices/1-1.1.2
auto suspend enabled!
# cat /sys/bus/usb/devices/1-1.1.2/power/*
386510
2
2000
391490
auto
auto
1
386060
suspended
4980
#

Ok thanks.

I’ll build the necessary bits in the UI and then we’re good to go.

2 Likes

Really like this “USB DAC Auto Suspend” function. So thanks for working on this solution :wink:

Allo Usbridge Sig in combination with a Topping D90

Old thread, but here I’ve with my DAC (AudioValve Luminare with DAC) and Ropieee 4.002 a problem:

lsusb

Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 010: ID 20b1:2023 XMOS Ltd
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I’ve activated in advanced USB Auto Suspend, but it’s not working.

[root@HoerraumLuminare 1-1.2]# pwd
/sys/bus/usb/devices/1-1.2
[root@HoerraumLuminare 1-1.2]# cat manufacturer
JLsounds
[root@HoerraumLuminare 1-1.2]#
[root@HoerraumLuminare 1-1.2]# cat power/*
13198270
-1
-1000
13198270
on
on
1
13198041
active
0

Any hint?

Acticating usb auto suspend (after deactivating it) shows:

[root@HoerraumLuminare ~]# /opt/RoPieee/lib/enable_usb_auto_suspend
found USB DAC!
id: 20b1:2023
devpath: /sys/bus/usb/devices/1-1.2
auto suspend enabled!