Merge lp:~roadmr/checkbox/1337270-mediacard-ssd into lp:checkbox

Proposed by Daniel Manrique
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 3102
Merged at revision: 3105
Proposed branch: lp:~roadmr/checkbox/1337270-mediacard-ssd
Merge into: lp:checkbox
Diff against target: 12 lines (+1/-1)
1 file modified
checkbox-support/checkbox_support/parsers/udevadm.py (+1/-1)
To merge this branch: bzr merge lp:~roadmr/checkbox/1337270-mediacard-ssd
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Review via email: mp+225559@code.launchpad.net

Commit message

checkbox-support:parsers:udevadm: Refine media card heuristics.

Per https://bugs.launchpad.net/checkbox-support/+bug/1337270, some SSD
hard drives have model names which made our card reader regular
expression mistake them for card readers (specifically the string mSATA
looked like a memory stick to our naive regex). This adds a simple
negative lookahead to ensure MS only matches if it's not followed
immediately by "ata". The regex is case-insensitive.

Description of the change

checkbox-support:parsers:udevadm: Refine media card heuristics.

Per https://bugs.launchpad.net/checkbox-support/+bug/1337270, some SSD
hard drives have model names which made our card reader regular
expression mistake them for card readers (specifically the string mSATA
looked like a memory stick to our naive regex). This adds a simple
negative lookahead to ensure MS only matches if it's not followed
immediately by "ata". The regex is case-insensitive.

I ran all the checkbox-support tests to ensure nothing else in device detection changed.

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

very cool regexp, thanks +1a

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox-support/checkbox_support/parsers/udevadm.py'
2--- checkbox-support/checkbox_support/parsers/udevadm.py 2014-06-19 19:00:36 +0000
3+++ checkbox-support/checkbox_support/parsers/udevadm.py 2014-07-03 19:44:37 +0000
4@@ -81,7 +81,7 @@
5 r"N(?P<name>.*?)"
6 r"T(?P<type>.*?)"
7 r"C(?P<compatible>.*?)")
8-CARD_READER_RE = re.compile(r"SD|MMC|CF|MS|SM|xD|Card", re.I)
9+CARD_READER_RE = re.compile(r"SD|MMC|CF|MS(?!ata)|SM|xD|Card", re.I)
10 GENERIC_RE = re.compile(r"Generic", re.I)
11 FLASH_RE = re.compile(r"Flash", re.I)
12 FLASH_DISK_RE = re.compile(r"Mass|Storage|Disk", re.I)

Subscribers

People subscribed via source and target branches