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

Proposed by Sylvain Pineau
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 0cd1c2493a31b9b9f6bfd5fdc4c5e479be9cff95
Merged at revision: 0ae26b3d9386ce145200af8116b9e158095e397b
Proposed branch: ~sylvain-pineau/checkbox-support:canbus_classic
Merge into: checkbox-support:master
Diff against target: 53 lines (+10/-5)
1 file modified
checkbox_support/parsers/udevadm.py (+10/-5)
Reviewer Review Type Date Requested Status
Paul Larson Approve
Review via email: mp+335232@code.launchpad.net

Description of the change

Improve CANBUS detection on classic where udev symlink are not available (they could on core thanks to gadget snaps)

To post a comment you must log in.
Revision history for this message
Paul Larson (pwlars) wrote :

+1, but one question...
Is this something we need to set up in the env before running checkbox? or does it get detected and set automatically?

review: Approve
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

@Paul not in the env, this categorization is the role of the udev parser which is used as a resource job to help templating several other jobs.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/checkbox_support/parsers/udevadm.py b/checkbox_support/parsers/udevadm.py
2index e1a5289..745941f 100644
3--- a/checkbox_support/parsers/udevadm.py
4+++ b/checkbox_support/parsers/udevadm.py
5@@ -507,7 +507,8 @@ class UdevadmDevice(object):
6 return "FLOPPY"
7
8 if "DEVLINKS" in self._environment:
9- if "canbus" in self._environment["DEVLINKS"]:
10+ if [i for i in ("canbus", "CANBus_HID", "USB_CAN_FD")
11+ if i in self._environment["DEVLINKS"]]:
12 return "CANBUS"
13
14 # Some audio and serial devices have a product but no vendor
15@@ -620,7 +621,8 @@ class UdevadmDevice(object):
16 return parent.product_id
17 # canbus
18 if "DEVLINKS" in self._environment:
19- if "canbus" in self._environment["DEVLINKS"]:
20+ if [i for i in ("canbus", "CANBus_HID", "USB_CAN_FD")
21+ if i in self._environment["DEVLINKS"]]:
22 if "ID_MODEL_ID" in self._environment:
23 return decode_id(self._environment["ID_MODEL_ID"])
24 return None
25@@ -660,7 +662,8 @@ class UdevadmDevice(object):
26 return parent.vendor_id
27 # canbus
28 if "DEVLINKS" in self._environment:
29- if "canbus" in self._environment["DEVLINKS"]:
30+ if [i for i in ("canbus", "CANBus_HID", "USB_CAN_FD")
31+ if i in self._environment["DEVLINKS"]]:
32 if "ID_VENDOR_ID" in self._environment:
33 return decode_id(self._environment["ID_VENDOR_ID"])
34 return None
35@@ -816,7 +819,8 @@ class UdevadmDevice(object):
36 return self._environment[element].strip('"')
37
38 if "DEVLINKS" in self._environment:
39- if "canbus" in self._environment["DEVLINKS"]:
40+ if [i for i in ("canbus", "CANBus_HID", "USB_CAN_FD")
41+ if i in self._environment["DEVLINKS"]]:
42 if "ID_MODEL_ENC" in self._environment:
43 return decode_id(self._environment["ID_MODEL_ENC"])
44 if "/dev/mapper" in self._environment["DEVLINKS"]:
45@@ -883,7 +887,8 @@ class UdevadmDevice(object):
46 return decode_id(self._environment["ID_VENDOR_ENC"])
47
48 if "DEVLINKS" in self._environment:
49- if "canbus" in self._environment["DEVLINKS"]:
50+ if [i for i in ("canbus", "CANBus_HID", "USB_CAN_FD")
51+ if i in self._environment["DEVLINKS"]]:
52 if "ID_VENDOR_ENC" in self._environment:
53 return decode_id(self._environment["ID_VENDOR_ENC"])
54

Subscribers

People subscribed via source and target branches