Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
(e)udev rules woes - naming a tricky interface [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Zucca
Veteran
Veteran


Joined: 14 Jun 2007
Posts: 1312
Location: KUUSANKOSKI, Finland

PostPosted: Mon Apr 23, 2018 5:11 pm    Post subject: (e)udev rules woes - naming a tricky interface [SOLVED] Reply with quote

I'm just about to give up.

I have an USB network interface (a cell phone) whose MAC address is randomly generated upon plugging.
For various reasons I need give it a custom interface name for easy recognition by scripts and whatnot.
The USB serial number stays the same every time. So I thought this would do it:
Code:
SUBSYSTEM=="net", ACTION=="add", ATTRS{serial}=="blahblah", NAME="eth_cellphone"
... but no. udevadm info -a -p <sysfs_path> clearly shows the serial, and I've checked it close to hundred times.
My rule file gets loaded, but ATTRS{serial}=="blahblah" just doesn't seem to match.

Anyone know what's wrong? I take all the wild guesses now.
_________________
..: Zucca :..

Code:
ERROR: '--failure' is not an option. Aborting...


Last edited by Zucca on Mon Apr 23, 2018 6:43 pm; edited 1 time in total
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 5889
Location: Room 101

PostPosted: Mon Apr 23, 2018 5:39 pm    Post subject: Reply with quote

Zucca ...

isn't it SUBSYSTEM=="usb" ... at least that's what I would expect, I've only the minutest knowledge about udev rules. Also, you probably want the 'ATTRS{idVendor}' in the rule because, as I remember, those matches are cumulative.

best ... khay
Back to top
View user's profile Send private message
Zucca
Veteran
Veteran


Joined: 14 Jun 2007
Posts: 1312
Location: KUUSANKOSKI, Finland

PostPosted: Mon Apr 23, 2018 6:42 pm    Post subject: Reply with quote

Thanks for the reply khayyam.

Out of pure luck I think I solved the problem. I needed to replace ACTION=="add" with ACTION!="remove". The device is now renamed with every insertion.

Also the subsystem is in fact "net". It's parent subsystem is "usb".

Oh well... Another udev oddity (to me at least) solved.
_________________
..: Zucca :..

Code:
ERROR: '--failure' is not an option. Aborting...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum