Re: A persistent name for a sound device.
On 04/02/14 02:33, peter@easthope.ca wrote:
> * From: Scott Ferguson scott.ferguson.debian.user@gmail.com
> * Date: Mon, 03 Feb 2014 16:30:49 +1100
>> There are a number of parent devices, don't try and match for more than
>> one value per parent device.
>> ...
>> KERNEL=="controlC3", ATTRS{idVendor}=="0d8c", ATTRS{idProduct}=="0008",
>> SYMLINK+="USBspeakers" GROUP=="sound"
>
> But idVendor and idProduct are on the same device node. :-/
Yes. Hence the next sentence.
>
>> or. same thing(?) without trying for two matches from the same parent,
>> and 'trying' to match particular card output:-
>> KERNEL=="controlC3", ATTRS{idProduct}=="0008", ATTRS{id}=="Device",
>> ATTRS{product}=="C-Media USB Audio Device ", SYMLINK+="USBspeakers"
>> GROUP=="sound"
>
> Here ATTRS{idProduct} and ATTRS{product} are in the same node and
> you just said "one value per parent device". <*)))-{
My mistake, don't use the idProduct. You simply need to match enough
values to uniquely identify the device. If that can be done with one
value then one value will do.
>
>> It might help if you posted the full path of the udev rule in case that
>> (it's name and location) is a problem.
>
> Turns out that this works.
>
> peter@dalton:~$ tail --lines=4 /etc/udev/rules.d/10-local.rules
> # The USB audio adapter connected to the speakers.
> #KERNEL=="controlC3", SUBSYSTEMS=="sound", SUBSYSTEMS=="usb", \
> KERNEL=="controlC3", \
> ATTRS{idProduct}=="0008", SYMLINK+="USBspeakers", GROUP="sound"
>
> It fails when 'SUBSYSTEMS=="sound", SUBSYSTEMS=="usb"' is included,
> whereas I expected the matching to be a little more efficient.
:)
Trying to match two values for KERNEL will also fail.
>
>> I thought the man page was the best guide, ...
>
> "If multiple
> keys that match a parent device are specified in a single rule, all
> these keys must match at one and the same parent device."
>
> So according to the manual, multiple keys on one device are OK.
Yes - that's what it says, but in my limited experience that's not the
case. So I usually try and match on the KERNEL or the SUBSYSTEMS, and
enough values about the devie to uniquely match it (that is usually
nodes "closest" to the actual device.
> But definitely room for improvement on this topic of matching.
>
>> http://www.reactivated.net/writing_udev_rules.html
>
> It explains about matching multiple keys on one device?
? I thought (from memory) he uses values from different nodes.
>
> In any case, one solution is enough and simpler is better.
Glad it works for you. I was in a hurry last night so didn't dig through
my notes or search for a previous post to this list about creating a
rule for Kindles where I stepped through the process of creating a rule
(might have been more useful). Today is the first day in while where the
temperatures haven't been in the 35 -40C range, where I haven't had to
continually shutdown computers, and my brain if finally beginning to
function(?) again. :/
>
> Thanks for the help, ... Peter E.
>
>
>
>
Kind regards
Reply to: