| Summary: | Feature request: Make devd read MAC addresses | ||
|---|---|---|---|
| Product: | Base System | Reporter: | greencoppermine |
| Component: | bin | Assignee: | freebsd-net (Nobody) <net> |
| Status: | Closed Not A Bug | ||
| Severity: | Affects Only Me | CC: | decui, florian.heigl, imp, jilles, portmaster |
| Priority: | --- | ||
| Version: | CURRENT | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
greencoppermine
2014-12-04 22:49:59 UTC
Not to mention, which I forgot, most vendor does NOT provide a unique serial number! Hence, the MAC address is really important to be able to get from devd. The MAC isn't a published piece of data in newbus. The data exists at the wrong layer for newbus to access it. devd operates only at the newbus level for most things. However, devd doesn't care or need to care. Just invoke a script whenever you get a ueX device. This script does a lookup on the MAC address using ifconfig. It can then rename it to whatever it wants for the fixup.
% cat /etc/ifmap
00:25:90:34:54:32 fred
00:25:90:34:44:23 barney
00:25:90:33:45:06 wilma
% cat fix-name
#!/bin/sh
dev=$1
mac=$(ifconfig $dev | grep ether | awk '{print $2;}')
name=$(grep ^$mac /etc/ifmap | awk '{print $2;}')
if [ -n $name ]; then
ifconfig $dev name $name
fi
%
which seems simple and straight forward enough...
I agree this would work. Nice solution based upon this: https://docs.freebsd.org/cgi/getmsg.cgi?fetch=778441+0+current/freebsd-net Thanks! (In reply to greencoppermine from comment #3) Hi, you gave a link to a working solution, but the link is dead. Do you happen to remember more info? Got a similar issue (hub full of usb2serial's) and don't yet understand to convince devd to do the right things. (call a script it seems) |