My mp3 player and udev should be friends instead of enemies!
I have a Sandisk Sansa Fuze mp3 player and it works great with Linux, except that in order to mount it at full USB 2 speed I have to run this script:
Code:
sudo rmmod ehci-hcd; sleep 1s; sudo modprobe ehci-hcd I followed udev's manual, and wrote a rule that looks like this: Code:
KERNEL=="sd?1", BUS=="scsi", SUBSYSTEMS=="usb", ATTRS{vendor}=="SanDisk*", ATTRS{model}=="Sansa*", RUN+="/bin/sh sansa" Code:
udevinfo -a -p /sys/block/sdb/dev Code:
looking at device '/block/sdb/dev': Thanks for your help in advance! |
I'm not a udev expert, but I'll give you some of my observations.
1) I believe programs run by udev run under the root user, so you shouldn't need to use the sudo command in your script. 2) Make sure your script is actually in proper script form. It should have an sh or bash shebang (#!) at the top, then each command on a separate line (not actually necessary, but better for readability). So it should look something like this: Code:
#!/bin/bash 3) In your udev rule, be sure to give it the full path to the script. And since the shebang in the script tells your system what shell to run it in, you shouldn't need to specify the shell in the run command itself. So your udev command should look something like this: Code:
KERNEL=="sd?1", BUS=="scsi", SUBSYSTEMS=="usb", ATTRS{vendor}=="SanDisk*", ATTRS{model}=="Sansa*", RUN+="/path/to/sansascript.sh" |
Cool, thanks so much for going to the effort of responding to me. The script (sansa.sh) definitely works (and has exec privileges), but udev still isn't running it so maybe that's because I haven't told it the correct details about the device.
Seems confusing...........so many parents. |
All times are GMT -5. The time now is 01:54 AM. |