rewrote get_net_intf_description() to use sysfs

do not use plip as net device any more
This commit is contained in:
Sergey Bolshakov 2008-02-29 20:09:32 +03:00
parent a205119533
commit b05b01a7b3
2 changed files with 11 additions and 15 deletions

View File

@ -88,11 +88,17 @@ void net_discovered_interface(char * intf_name)
char * get_net_intf_description(char * intf_name)
{
int i;
for (i = 0; i < net_descr_number ; i++)
if (!strcmp(net_descriptions[i].intf_name, intf_name))
return net_descriptions[i].intf_description;
return strdup("unknown");
char dev[SYSFS_PATH_MAX];
char drv[SYSFS_PATH_MAX];
ssize_t i;
snprintf(dev, SYSFS_PATH_MAX, "/sys/class/net/%s/device/driver", intf_name);
if ((i = readlink(dev, drv, SYSFS_PATH_MAX)) > 0) {
drv[i] = '\0';
return strdup(basename(drv));
} else {
return strdup("unknown");
}
}
#endif
@ -237,13 +243,6 @@ void get_medias(enum media_type media, char *** names, char *** models)
}
#endif /* DISABLE_MEDIAS */
void probe_hiddev()
{
/* FIXME
usb_probe(HID_DEVICES);
*/
}
#ifndef DISABLE_NETWORK
static int net_device_available(char * device)
{
@ -271,7 +270,6 @@ char ** get_net_devices(void)
char * devices[] = {
"eth0", "eth1", "eth2", "eth3", "eth4", "eth5",
"tr0",
"plip0", "plip1", "plip2",
"fddi0",
#ifdef ENABLE_USBNET
"usb0", "usb1", "usb2", "usb3",

View File

@ -24,8 +24,6 @@
enum media_type { CDROM, DISK, FLOPPY, TAPE, UNKNOWN_MEDIA };
enum driver_type { IDE_ADAPTERS, SCSI_ADAPTERS, RAID_ADAPTERS, MEDIA_ADAPTERS, NETWORK_DEVICES, HID_DEVICES, USB_CONTROLLERS, BRIDGE_OTHER, ANY_DRIVER_TYPE };
void get_medias(enum media_type media, char *** names, char *** models);
void probe_hiddev();
char ** get_net_devices(void);