From mboxrd@z Thu Jan 1 00:00:00 1970 From: md@Linux.IT (Marco d'Itri) Date: Thu, 13 Apr 2006 10:36:27 +0000 Subject: Re: net interface renaming issue (+fix?) Message-Id: <20060413103627.GA6818@wonderland.linux.it> MIME-Version: 1 Content-Type: multipart/mixed; boundary="XsQoSWH+UP9D9v3l" List-Id: References: <20060409192140.73644723@eusebe> In-Reply-To: <20060409192140.73644723@eusebe> To: linux-hotplug@vger.kernel.org --XsQoSWH+UP9D9v3l Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Apr 13, Kay Sievers wrote: > But right, the longer term goal is that the notion of "physical devices" > and "virtual devices" should not be exported that way by the kernel > and therefore the use of these values, or the "device" link, or the > symlinks, or a hardcoded sequence of sysfs parent > devices must be avoided for other things than temporary workarounds. How should I rewrite this code then? device_description() { local bus=3D$(sysreadlink device/bus) bus=3D${bus##*/} if [ "$bus" =3D pci ]; then local vendor_id=3D$(sysread device/vendor) local device_id=3D$(sysread device/device) echo -n "PCI device ${vendor_id#0x}:${device_id#0x}" elif [ "$bus" =3D usb ]; then local device=3D$(sysreadlink device) if [ "$device" -a -e $device/../idVendor ]; then local idVendor idProduct read idVendor < $device/../idVendor || true read idProduct < $device/../idProduct || true printf 'USB device %x/%x' 0x$idVendor 0x$idProduct else echo -n "UNKNOWN USB device ($DEVPATH)" fi elif [ "$bus" ]; then echo -n "UNKNOWN $bus device ($DEVPATH)" else echo -n "UNKNOWN device ($DEVPATH)" fi local driver=3D$(sysreadlink device/driver) if [ "$driver" ]; then echo -n " (${driver##*/})"; fi } --=20 ciao, Marco --XsQoSWH+UP9D9v3l Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) iD8DBQFEPimrFGfw2OHuP7ERAiXMAKCIfZIn1c/tKAQ6O5lOxnkbUenQswCbBFpO xivDU9l/kz/5B4vXAtSlsdM= =g2bA -----END PGP SIGNATURE----- --XsQoSWH+UP9D9v3l-- ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel