[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Changed device for camera..



Charlie <ariestao@clearmail.com.au> writes:

> Thanks for that Ron, but the camera mounts again on /dev/sda1 and when I want 
> to write the udev rules for it they won't write but choke on the attributes 
> of:
>
> * ATTRS{serial} command not found
> * ATTRS{model} command not found
> * ATTRS{modalias} command not found

Why so many ATTRS?  I have an mp3 player and I used only ATTRS{product}
as that is specific enough to only apply to that one device.  The main
problem I ran into back when I was trying to get udev working was
accidentally mixing ATTRS from different blocks of udevinfo, or putting
my ATTRS under a SUBSYSTEM they didn't come from.  Be careful to look at
the output for udevinfo carefully, and whatever ATTR or ATTRS you use
take them from the same block, and when you use a SUBSYSTEM or KERNEL
node be equally careful that the ATTRS that follow it in your rule
actually come from the same device in udevinfo.  This kind of thing
seems to completely stop the rule from working.

What I did was to run `udevinfo -a -p $(udevinfo -q path -n /dev/sda)` 
and then I looked for the most specific ATTR I could find.
For mine that was ATTRS{product}=="Sansa e260R", which was directly
under SUBSYSTEMS=="usb".  Above all of this, in another block, was
SUBSYSTEM=="block", which I also used in the first position. 
So, in /etc/udev/rules.d/10-local.rules I put this: 
SUBSYSTEM=="block", SUBSYSTEMS=="usb", ATTRS{product}=="Sansa e260R", SYMLINK+="sansa" 

In this case I used two separate devices to define the rule, the "block"
and "usb" were from separate device sections of udevinfo.  However, the
attribute came from the same device as SUBSYSTEMS=="usb" and so it
worked okay.  From what I can tell this is crucial.  

Something else to consider may be whether you are trying to change the
/dev/sda1 link.  I didn't try that in the end, and instead just used
SYMLINK+= to create a new link in addition to the ones already made by
udev, such as sda1 or sdb1.  You can use the new link as easily as any
other and it is less trouble to get working, in my experience, than is
trying to actually override the rest of what udev wants to do.

Have you considered, though, using /dev/disk/by-uuid instead?  As far as I
can tell that link never changes and is very specific to the device
itself.  For instance, on my system when I plug in my Sansa above there
is created in /dev/disk/by-uuid a symlink 3874-E1C0 which points to
/dev/sda1.  In my fstab I just have UUID=3874-E1C0 instead of
/dev/sda1 and it mounts up just fine.  And no mucking about with udev at
all.

Good luck,

Patrick


Reply to: