mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-05 04:41:20 +00:00
v2 of Cole's wlan support
* Incorporated Jim's feedback (v1 & v2) * Moved case of DEVTYPE == "wlan" up as it's definitive that we have a network interface. * Made comment more detailed about the wired case to explain better how it differentiates between wired network interfaces and USB devices.
This commit is contained in:
parent
dafd354d12
commit
07f6c3a95f
@ -597,8 +597,15 @@ static int udevProcessNetworkInterface(struct udev_device *device,
|
|||||||
virNodeDeviceDefPtr def)
|
virNodeDeviceDefPtr def)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
const char *devtype = udev_device_get_devtype(device);
|
||||||
union _virNodeDevCapData *data = &def->caps->data;
|
union _virNodeDevCapData *data = &def->caps->data;
|
||||||
|
|
||||||
|
if (devtype && STREQ(devtype, "wlan")) {
|
||||||
|
data->net.subtype = VIR_NODE_DEV_CAP_NET_80211;
|
||||||
|
} else {
|
||||||
|
data->net.subtype = VIR_NODE_DEV_CAP_NET_80203;
|
||||||
|
}
|
||||||
|
|
||||||
if (udevGetStringProperty(device,
|
if (udevGetStringProperty(device,
|
||||||
"INTERFACE",
|
"INTERFACE",
|
||||||
&data->net.ifname) == PROPERTY_ERROR) {
|
&data->net.ifname) == PROPERTY_ERROR) {
|
||||||
@ -1074,6 +1081,8 @@ static int udevGetDeviceType(struct udev_device *device,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
devtype = udev_device_get_devtype(device);
|
devtype = udev_device_get_devtype(device);
|
||||||
|
VIR_DEBUG("Found device type '%s' for device '%s'",
|
||||||
|
NULLSTR(devtype), udev_device_get_sysname(device));
|
||||||
|
|
||||||
if (devtype != NULL && STREQ(devtype, "usb_device")) {
|
if (devtype != NULL && STREQ(devtype, "usb_device")) {
|
||||||
*type = VIR_NODE_DEV_CAP_USB_DEV;
|
*type = VIR_NODE_DEV_CAP_USB_DEV;
|
||||||
@ -1105,13 +1114,20 @@ static int udevGetDeviceType(struct udev_device *device,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (devtype != NULL && STREQ(devtype, "wlan")) {
|
||||||
|
*type = VIR_NODE_DEV_CAP_NET;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (udevGetUintProperty(device, "PCI_CLASS", &tmp, 16) == PROPERTY_FOUND) {
|
if (udevGetUintProperty(device, "PCI_CLASS", &tmp, 16) == PROPERTY_FOUND) {
|
||||||
*type = VIR_NODE_DEV_CAP_PCI_DEV;
|
*type = VIR_NODE_DEV_CAP_PCI_DEV;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* It does not appear that network interfaces set the device type
|
/* It does not appear that wired network interfaces set the
|
||||||
* property. */
|
* DEVTYPE property. USB devices also have an INTERFACE property,
|
||||||
|
* but they do set DEVTYPE, so if devtype is NULL and the
|
||||||
|
* INTERFACE property exists, we have a network device. */
|
||||||
if (devtype == NULL &&
|
if (devtype == NULL &&
|
||||||
udevGetStringProperty(device,
|
udevGetStringProperty(device,
|
||||||
"INTERFACE",
|
"INTERFACE",
|
||||||
|
Loading…
Reference in New Issue
Block a user