From 6e49a11b0b3ecb74006ed3c8a26d5f78933db3c9 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 26 Jan 2004 00:10:20 +0000 Subject: (getNetDriver) introduce getHwIDs() alias that return pci/usb/... hw addr (or "N/A" for some isapnp cards due to lack of support from drivers) --- perl-install/c/stuff.xs.pl | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'perl-install/c') diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl index ec4047b0c..252e889b7 100644 --- a/perl-install/c/stuff.xs.pl +++ b/perl-install/c/stuff.xs.pl @@ -484,6 +484,8 @@ hasNetDevice(device) char* getNetDriver(char* device) + ALIAS: + getHwIDs = 1 CODE: struct ifreq ifr; struct ethtool_drvinfo drvinfo; @@ -495,9 +497,16 @@ getNetDriver(char* device) drvinfo.cmd = ETHTOOL_GDRVINFO; ifr.ifr_data = (caddr_t) &drvinfo; - if (ioctl(s, SIOCETHTOOL, &ifr) != -1) - RETVAL = strdup(drvinfo.driver); - else { perror("SIOCETHTOOL"); RETVAL = strdup(""); } + if (ioctl(s, SIOCETHTOOL, &ifr) != -1) { + switch (ix) { + case 0: + RETVAL = strdup(drvinfo.driver); + break; + case 1: + RETVAL = strdup(drvinfo.bus_info); + break; + } + } else { perror("SIOCETHTOOL"); RETVAL = strdup(""); } OUTPUT: RETVAL -- cgit v1.2.1