You are not logged in.

#1 2018-05-25 00:49:56

Brocellous
Member
Registered: 2017-11-27
Posts: 162

Udev rule not triggering

This seems like kind of a dumb question, but I'm having trouble getting my udev rule to run.

The long story is I've had trouble with bluetooth on my laptop (Dell XPS 15 9560) for a long time where bluetooth randomly disconnects after inactivity for a random amount of time less than 10 minutes. I looked in the journal at the time of disconnect and found

May 24 12:09:11 rxps kernel: usb 1-4: USB disconnect, device number 2
May 24 12:09:11 rxps bluetoothd[847]: Unable to get io data for Headset Voice gateway: getpeername: Transport endpoint is not connected (107)
May 24 12:09:11 rxps bluetoothd[847]: No matching connection for device
May 24 12:09:11 rxps bluetoothd[847]: Endpoint unregistered: sender=:1.27 path=/MediaEndpoint/A2DPSource
May 24 12:09:11 rxps bluetoothd[847]: Endpoint unregistered: sender=:1.27 path=/MediaEndpoint/A2DPSink
May 24 12:09:11 rxps NetworkManager[433]: <info>  [1527188951.8367] bluez5: NAP: removed interface 9C:B6:D0:EE:59:2C
May 24 12:09:11 rxps upowerd[1764]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.1
May 24 12:09:11 rxps dbus-daemon[432]: [system] Rejected send message, 1 matched rules; type="method_return", sender=":1.27" (uid=1000 pid=908 comm="/usr/bin/pulseaudio --daemonize=no ") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.18" (uid=0 pid=847 comm="/usr/lib/bluetooth/bluetoothd ")
May 24 12:09:11 rxps systemd[1]: bluetooth.target: Unit not needed anymore. Stopping.
May 24 12:09:11 rxps dbus-daemon[432]: [system] Rejected send message, 1 matched rules; type="error", sender=":1.27" (uid=1000 pid=908 comm="/usr/bin/pulseaudio --daemonize=no ") interface="(unset)" member="(unset)" error name="org.bluez.MediaEndpoint1.Error.NotImplemented" requested_reply="0" destination=":1.18" (uid=0 pid=847 comm="/usr/lib/bluetooth/bluetoothd ")
May 24 12:09:11 rxps systemd[1]: Stopped target Bluetooth.

I found that the bluetooth device is connected by usb on this laptop and it seems to be a faulty autosuspend issue like described here https://www.kernel.org/doc/html/v4.16/d … ement.html

The USB specification states that all USB devices must support power management. Nevertheless, the sad fact is that many devices do not support it very well. You can suspend them all right, but when you try to resume them they disconnect themselves from the USB bus or they stop working entirely.

That doc describes how I can disable autosuspend by changing

echo "on" > /sys/bus/usb/devices/1-4/power/control

on that device. I tried that from the command line and I think it worked.

I want to make that change permanent, and I think this is a job for udev, so I made a new file /etc/udev/rules.d/10-local.rules and added the the rule

SUBSYSTEM=="usb", ATTR{idVendor}=="0cf3", ATTR{idProduct}=="e301", ATTR{power/control}="on"

but upon reboot, the setting is not changed. I know that the ids match, and even running (as root)

udevadm test /sys/bus/usb/devices/1-4/power/control

switches the attribute as desired, it just doesn't run automatically.

How can I trigger this rule to run on startup? Am I even on the right track here, or is there another way I should be configuring the default value of this parameter? Is it possible my suspend issue and this rule not running are related?

Thanks

Offline

#2 2018-05-25 04:24:41

ooo
Member
Registered: 2013-04-10
Posts: 1,638

Re: Udev rule not triggering

Did you try disabling autosuspend with enable_autosuspend=0 module option for btusb? I think that would be more straight forward solution than udev rule.

I think you're just missing ACTION from beginning of the rule, to trigger it when a device is added. Try:

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0cf3", ATTR{idProduct}=="e301", ATTR{power/control}="on"

Last edited by ooo (2018-05-25 04:27:11)

Offline

Board footer

Powered by FluxBB