Merge ~sylvain-pineau/checkbox-support:wwan_category into checkbox-support:master

Proposed by Sylvain Pineau
Status: Merged
Approved by: Sylvain Pineau
Approved revision: fd96af425c03588cb3f08e6c5b4a9b9ba887397c
Merged at revision: 54b3a73b6c7c54a8e068fd91413875d11d0af846
Proposed branch: ~sylvain-pineau/checkbox-support:wwan_category
Merge into: checkbox-support:master
Diff against target: 76 lines (+10/-7)
2 files modified
checkbox_support/parsers/tests/test_udevadm.py (+4/-3)
checkbox_support/parsers/udevadm.py (+6/-4)
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+321199@code.launchpad.net

Description of the change

This MR introduces the WWAN category, to avoid grouping under NETWORK ethernet devices and wwan.

Nota: NETWORK is definitely not ideal as a category name but I prefer to keep it as is.

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

tested on desktop and snappy systems, both having a WWAN device.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/checkbox_support/parsers/tests/test_udevadm.py b/checkbox_support/parsers/tests/test_udevadm.py
index 1597696..12a8d57 100644
--- a/checkbox_support/parsers/tests/test_udevadm.py
+++ b/checkbox_support/parsers/tests/test_udevadm.py
@@ -551,7 +551,7 @@ E: UDEV_LOG=3
551 ("82579LM Gigabit Network Connection",551 ("82579LM Gigabit Network Connection",
552 "NETWORK", "pci", 0x8086, 0x1502),552 "NETWORK", "pci", 0x8086, 0x1502),
553 ("H5321 gw",553 ("H5321 gw",
554 "NETWORK", "usb", 0x0bdb, 0x1926)554 "WWAN", "usb", 0x0bdb, 0x1926)
555 ]555 ]
556 self.assertEqual(len(devices), 103)556 self.assertEqual(len(devices), 103)
557 # Check that the Thinkpad hotkeys are not a CAPTURE device557 # Check that the Thinkpad hotkeys are not a CAPTURE device
@@ -563,7 +563,7 @@ E: UDEV_LOG=3
563 self.assertEqual(563 self.assertEqual(
564 devices[54].vendor,564 devices[54].vendor,
565 "Ericsson Business Mobile Networks BV")565 "Ericsson Business Mobile Networks BV")
566 self.assertEqual(devices[54].category, "NETWORK")566 self.assertEqual(devices[54].category, "WWAN")
567 self.assertEqual(self.count(devices, "VIDEO"), 1)567 self.assertEqual(self.count(devices, "VIDEO"), 1)
568 self.assertEqual(self.count(devices, "AUDIO"), 9)568 self.assertEqual(self.count(devices, "AUDIO"), 9)
569 # Logitech Illuminated keyboard + T430S keyboard + KVM569 # Logitech Illuminated keyboard + T430S keyboard + KVM
@@ -578,7 +578,8 @@ E: UDEV_LOG=3
578 self.assertEqual(self.count(devices, "DISK"), 1)578 self.assertEqual(self.count(devices, "DISK"), 1)
579 self.assertEqual(self.count(devices, "RAID"), 0)579 self.assertEqual(self.count(devices, "RAID"), 0)
580 self.assertEqual(self.count(devices, "BLUETOOTH"), 1)580 self.assertEqual(self.count(devices, "BLUETOOTH"), 1)
581 self.assertEqual(self.count(devices, "NETWORK"), 2)581 self.assertEqual(self.count(devices, "NETWORK"), 1)
582 self.assertEqual(self.count(devices, "WWAN"), 1)
582 self.assertEqual(self.count(devices, "CAPTURE"), 2)583 self.assertEqual(self.count(devices, "CAPTURE"), 2)
583 self.assertEqual(self.count(devices, "WIRELESS"), 1)584 self.assertEqual(self.count(devices, "WIRELESS"), 1)
584 self.verify_devices(devices, expected_devices)585 self.verify_devices(devices, expected_devices)
diff --git a/checkbox_support/parsers/udevadm.py b/checkbox_support/parsers/udevadm.py
index 8bde51c..6c493dd 100644
--- a/checkbox_support/parsers/udevadm.py
+++ b/checkbox_support/parsers/udevadm.py
@@ -205,6 +205,8 @@ class UdevadmDevice(object):
205 devtype = self._environment["DEVTYPE"]205 devtype = self._environment["DEVTYPE"]
206 if devtype in ("wlan", "wimax"):206 if devtype in ("wlan", "wimax"):
207 return "WIRELESS"207 return "WIRELESS"
208 elif devtype == "wwan":
209 return "WWAN"
208 # Ralink and realtek SDIO wireless210 # Ralink and realtek SDIO wireless
209 if "INTERFACE" in self._environment:211 if "INTERFACE" in self._environment:
210 if (self.driver and212 if (self.driver and
@@ -820,7 +822,7 @@ class UdevadmDevice(object):
820 def interface(self):822 def interface(self):
821 if self._interface is not None:823 if self._interface is not None:
822 return self._interface824 return self._interface
823 if self.category in ("NETWORK", "WIRELESS"):825 if self.category in ("NETWORK", "WIRELESS", "WWAN"):
824 if "INTERFACE" in self._environment:826 if "INTERFACE" in self._environment:
825 return self._environment["INTERFACE"]827 return self._environment["INTERFACE"]
826 else:828 else:
@@ -831,7 +833,7 @@ class UdevadmDevice(object):
831 def mac(self):833 def mac(self):
832 if self._mac is not None:834 if self._mac is not None:
833 return self._mac835 return self._mac
834 if self.category in ("NETWORK", "WIRELESS"):836 if self.category in ("NETWORK", "WIRELESS", "WWAN"):
835 if "ID_NET_NAME_MAC" in self._environment:837 if "ID_NET_NAME_MAC" in self._environment:
836 mac = self._environment["ID_NET_NAME_MAC"][3:]838 mac = self._environment["ID_NET_NAME_MAC"][3:]
837 return ':'.join([mac[i:i+2] for i in range(0, len(mac), 2)])839 return ':'.join([mac[i:i+2] for i in range(0, len(mac), 2)])
@@ -1044,10 +1046,10 @@ class UdevadmParser(object):
1044 stack.append(device)1046 stack.append(device)
10451047
1046 for device in list(self.devices.values()):1048 for device in list(self.devices.values()):
1047 if device.category in ("NETWORK", "WIRELESS", "OTHER"):1049 if device.category in ("NETWORK", "WIRELESS", "WWAN", "OTHER"):
1048 dev_interface = [1050 dev_interface = [
1049 d for d in self.devices.values()1051 d for d in self.devices.values()
1050 if d.category in ("NETWORK", "WIRELESS") and1052 if d.category in ("NETWORK", "WIRELESS", "WWAN") and
1051 device._raw_path != d._raw_path and1053 device._raw_path != d._raw_path and
1052 device._raw_path + '/' in d._raw_path1054 device._raw_path + '/' in d._raw_path
1053 ]1055 ]

Subscribers

People subscribed via source and target branches