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
1diff --git a/checkbox_support/parsers/tests/test_udevadm.py b/checkbox_support/parsers/tests/test_udevadm.py
2index 1597696..12a8d57 100644
3--- a/checkbox_support/parsers/tests/test_udevadm.py
4+++ b/checkbox_support/parsers/tests/test_udevadm.py
5@@ -551,7 +551,7 @@ E: UDEV_LOG=3
6 ("82579LM Gigabit Network Connection",
7 "NETWORK", "pci", 0x8086, 0x1502),
8 ("H5321 gw",
9- "NETWORK", "usb", 0x0bdb, 0x1926)
10+ "WWAN", "usb", 0x0bdb, 0x1926)
11 ]
12 self.assertEqual(len(devices), 103)
13 # Check that the Thinkpad hotkeys are not a CAPTURE device
14@@ -563,7 +563,7 @@ E: UDEV_LOG=3
15 self.assertEqual(
16 devices[54].vendor,
17 "Ericsson Business Mobile Networks BV")
18- self.assertEqual(devices[54].category, "NETWORK")
19+ self.assertEqual(devices[54].category, "WWAN")
20 self.assertEqual(self.count(devices, "VIDEO"), 1)
21 self.assertEqual(self.count(devices, "AUDIO"), 9)
22 # Logitech Illuminated keyboard + T430S keyboard + KVM
23@@ -578,7 +578,8 @@ E: UDEV_LOG=3
24 self.assertEqual(self.count(devices, "DISK"), 1)
25 self.assertEqual(self.count(devices, "RAID"), 0)
26 self.assertEqual(self.count(devices, "BLUETOOTH"), 1)
27- self.assertEqual(self.count(devices, "NETWORK"), 2)
28+ self.assertEqual(self.count(devices, "NETWORK"), 1)
29+ self.assertEqual(self.count(devices, "WWAN"), 1)
30 self.assertEqual(self.count(devices, "CAPTURE"), 2)
31 self.assertEqual(self.count(devices, "WIRELESS"), 1)
32 self.verify_devices(devices, expected_devices)
33diff --git a/checkbox_support/parsers/udevadm.py b/checkbox_support/parsers/udevadm.py
34index 8bde51c..6c493dd 100644
35--- a/checkbox_support/parsers/udevadm.py
36+++ b/checkbox_support/parsers/udevadm.py
37@@ -205,6 +205,8 @@ class UdevadmDevice(object):
38 devtype = self._environment["DEVTYPE"]
39 if devtype in ("wlan", "wimax"):
40 return "WIRELESS"
41+ elif devtype == "wwan":
42+ return "WWAN"
43 # Ralink and realtek SDIO wireless
44 if "INTERFACE" in self._environment:
45 if (self.driver and
46@@ -820,7 +822,7 @@ class UdevadmDevice(object):
47 def interface(self):
48 if self._interface is not None:
49 return self._interface
50- if self.category in ("NETWORK", "WIRELESS"):
51+ if self.category in ("NETWORK", "WIRELESS", "WWAN"):
52 if "INTERFACE" in self._environment:
53 return self._environment["INTERFACE"]
54 else:
55@@ -831,7 +833,7 @@ class UdevadmDevice(object):
56 def mac(self):
57 if self._mac is not None:
58 return self._mac
59- if self.category in ("NETWORK", "WIRELESS"):
60+ if self.category in ("NETWORK", "WIRELESS", "WWAN"):
61 if "ID_NET_NAME_MAC" in self._environment:
62 mac = self._environment["ID_NET_NAME_MAC"][3:]
63 return ':'.join([mac[i:i+2] for i in range(0, len(mac), 2)])
64@@ -1044,10 +1046,10 @@ class UdevadmParser(object):
65 stack.append(device)
66
67 for device in list(self.devices.values()):
68- if device.category in ("NETWORK", "WIRELESS", "OTHER"):
69+ if device.category in ("NETWORK", "WIRELESS", "WWAN", "OTHER"):
70 dev_interface = [
71 d for d in self.devices.values()
72- if d.category in ("NETWORK", "WIRELESS") and
73+ if d.category in ("NETWORK", "WIRELESS", "WWAN") and
74 device._raw_path != d._raw_path and
75 device._raw_path + '/' in d._raw_path
76 ]

Subscribers

People subscribed via source and target branches