LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Udev and eject problems with Ipod (http://www.linuxquestions.org/questions/slackware-14/udev-and-eject-problems-with-ipod-554726/)

arubin 05-17-2007 04:41 PM

Udev and eject problems with Ipod
 
Ok so I have my ipod nano working with amarok but there are 2 things that are unsatisfactory.

Problem 1.
I have to mount it with /dev/sdc2. For my other usb devices I have udev rules to create specific /dev/ files but I cannot get this to work with the ipod, possibly because it has to be sd*2 rather than 1. I have seen various suggestions eg

BUS=="scsi", SYSFS{model}=="iPod*", NAME=="ipod"
BUS=="scsi", SYSFS{model}=="iPod*" KERNEL=="sd?2", NAME+="ipod", SYMLINK="%k", MODE="0777", GROUP="ipod"

but none of these work for me.


Problem 2
To eject I have to su to root. How can I eject as a user?

One suggestion I have seen is to edit the sudoers file as below. Is that safe?

Quote:

# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

# Host alias specification

# User alias specification

# Cmnd alias specification
Cmnd_Alias EJECT=/usr/bin/eject
# Defaults

Defaults !lecture,tty_tickets,!fqdn

# User privilege specification
root ALL=(ALL) ALL
ben ALL= NOPASSWD : EJECT

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL




rworkman 05-17-2007 08:29 PM

Quote:

Originally Posted by arubin
I have to mount it with /dev/sdc2. For my other usb devices I have udev rules to create specific /dev/ files but I cannot get this to work with the ipod, possibly because it has to be sd*2 rather than 1. I have seen various suggestions eg

BUS=="scsi", SYSFS{model}=="iPod*", NAME=="ipod"
BUS=="scsi", SYSFS{model}=="iPod*" KERNEL=="sd?2", NAME+="ipod", SYMLINK="%k", MODE="0777", GROUP="ipod"

but none of these work for me.

This rule is bad. First, don't change the name of device; use the kernel name - make the symlink customized.
BUS=="scsi", SYSFS{model}=="iPod*", KERNEL=="sd?2", NAME="%k", SYMLINK+="ipod", MODE="0664", GROUP:="ipod"

This assumes you want all users to be able to read the device, and only members of group 'ipod' to write to it, and that group 'ipod' actually exists, and that your user is a member of that group.

See http://slackwiki.org/Udev for more information on the syntax used and such...


Quote:

To eject I have to su to root. How can I eject as a user?
Assuming the above information is following, this should "just work."

arubin 05-18-2007 02:12 AM

When you say don't change the name, use the symlink - is that for the ipod or for all devices. I generally change the name and have found that it works fine for me. This is my rules file.

Quote:

SUBSYSTEM=="block", SYSFS{size}=="2050209", NAME+="mpman"
SUBSYSTEM=="block", SYSFS{model}=="Cruzer Mini*", NAME+="cruzer"
SUBSYSTEM=="block", SYSFS{model}=="Flash*", NAME+="flash"
SUBSYSTEM=="block", SYSFS{model}=="Evoke*", NAME+="evoke"
SUBSYSTEM=="block", SYSFS{model}=="00JB-22REA0*", NAME+="external"
SYSFS{idVendor}=="04a9", SYSFS{idProduct}=="3058", GROUP="users"
SYSFS{idVendor}=="04a9", SYSFS{idProduct}=="3126", GROUP="users"
SUBSYSTEM=="block", SYSFS{model}=="USB Flash*", NAME+="disgo"

rworkman 05-18-2007 02:19 AM

I don't recall specifics now, and it's late (0215 here), so I don't feel like searching for the relevant information, but I do recall reading somewhere (from one of the udev maintainers, I think) that renaming devices can potentially cause some problems (but again, I don't recall specifics). So far as I'm concerned, that is/was good enough reason to not do it, especially since creating the custom symlinks works just fine. For me, it seems to be a bit more elegant solution too, but that's just me... :-)


All times are GMT -5. The time now is 02:22 AM.