$attr substitution for parent devices

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

 



Hi,

I have the following rules file:
#######################################################################################
ACTION!="add", GOTO="modeswitch_rules_end"
SUBSYSTEM!="usb", GOTO="modeswitch_rules_end"

ATTRS{bDeviceClass}=="08", GOTO="modeswitch_rules_begin"
ATTRS{bInterfaceClass}=="08", GOTO="modeswitch_rules_begin"
GOTO="modeswitch_rules_end"

LABEL="modeswitch_rules_begin"

ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1003",
RUN+="/usr/sbin/usb_modeswitch -c
/etc/usb_modeswitch.d/$attr{idVendor}:$attr{idProduct}"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1414",
RUN+="/usr/sbin/usb_modeswitch -c
/etc/usb_modeswitch.d/$attr{idVendor}:$attr{idProduct}"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446",
RUN+="/usr/sbin/usb_modeswitch -c
/etc/usb_modeswitch.d/$attr{idVendor}:$attr{idProduct}"

LABEL="modeswitch_rules_end"
########################################################################################

When the matching rule is not the last rule in the file, $attr is
substituted by an empty string.
I've found out that by the time the RUN format gets applied
event->dev_parent is NULL, so it doesn't find the attributes for
substitution.
In udev_rules_apply_to_event event->dev_parent is used to loop over
the parent devices. If there are multiple rules trying to match parent
properties, event->dev_parent will be reset to NULL when there's a
non-matching rule following a matching rule.

Is this the expected behavior or not?
In this case the logical thing to do would be to substitute the format
while processing the rules. But the man-page says there are reasons to
 apply the RUN format after all rules have been processed.

thanks,
Cedric
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux