Merge lp:~adeuring/launchpad/hwdb-udev-submissions-noise-reduction-2 into lp:launchpad

Proposed by Abel Deuring
Status: Merged
Approved by: Muharem Hrnjadovic
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~adeuring/launchpad/hwdb-udev-submissions-noise-reduction-2
Merge into: lp:launchpad
Diff against target: 128 lines (+52/-25)
2 files modified
lib/canonical/launchpad/scripts/hwdbsubmissions.py (+37/-13)
lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py (+15/-12)
To merge this branch: bzr merge lp:~adeuring/launchpad/hwdb-udev-submissions-noise-reduction-2
Reviewer Review Type Date Requested Status
Muharem Hrnjadovic (community) Approve
Review via email: mp+14479@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Abel Deuring (adeuring) wrote :

This branch adds a several bus names to the sets of names known in class BaseDevice which

- are used for udev nodes that do not describe real, physical devices but only "aspects" or real devices, or
- are used for "virtual" devices, i.e., for artefacts of the Linux kernel.

Background: The HWDB submission processing script represents devices as described by udev or HAL as instances of class UdevDevice or class HALDevice. These classes have methods to populate HWDB tables with data from a submission; these methods need to know (a) if a given instance describes a real device or only an "aspect" of a real device (property BaseDevice.is_real_device) and (b) if a device provides enough data and if a device is "interesting enough" to be stored in the HWDB (property BaseDevice.has_reliable_data).

Both properties use tuples of bus names to decide, how a device with a given bus name should be treated. Since Karmic was released, we received a considerable number of submissions which contain udev devicea that fall in one of the categories described above, but which were not yet listed in the tuples of "known to be unterinteresting" bus names. This branch adds these bus names.

test: ./bin/test -t test_hwdb_submission_processing

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/canonical/launchpad/scripts/hwdbsubmissions.py
  lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py

== Pyflakes notices ==

lib/canonical/launchpad/scripts/hwdbsubmissions.py
    22: redefinition of unused 'etree' from line 20

== Pylint notices ==

lib/canonical/launchpad/scripts/hwdbsubmissions.py
    20: [F0401] Unable to import 'xml.etree.cElementTree' (No module named etree)

lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py
    2118: [E0601, TestHWDBSubmissionProcessing.testHasReliableDataForInsuffientData] Using variable 'test_device' before assignment

The etree messages are not related to my changes.

The message E0601 indicates either that I'm becoming senile (can't see anything wrong there: test_device is defined in line 2117) or that pylint is on crack. Also, the affected method is not changed.

Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/scripts/hwdbsubmissions.py'
2--- lib/canonical/launchpad/scripts/hwdbsubmissions.py 2009-10-27 14:12:10 +0000
3+++ lib/canonical/launchpad/scripts/hwdbsubmissions.py 2009-11-09 09:30:26 +0000
4@@ -2018,7 +2018,26 @@
5
6 'hwmon' is is used in submissions with udev data in
7 many sub-nodes.
8- """
9+
10+ 'sas_phy', 'sas_device', 'sas_end_device', 'sas_port',
11+ 'sas_host' is used in submissions with udev data for
12+ details of SAS controllers.
13+
14+ 'mISDN' is used in submissions with udev data for the
15+ I/O aspects of ISDN adapters.
16+
17+ 'pvrusb2' is used in submissions with udev data for the
18+ input aspect of some DVB adapters.
19+
20+ 'memstick' is used in submissions with udev data for the
21+ I/O aspect of memory stick controllers.
22+
23+ 'bttv-sub' is used in submissions with udev data for the
24+ I/O aspects of some TV receivers.
25+
26+ 'scsi_tape' is used in submissions with udev data for
27+ details of SCSI tape drives.
28+ """
29 # The root node is always a real device, but its raw_bus
30 # property can have different values: None or 'Unknown' in
31 # submissions with HAL data, 'acpi' for submissions with udev
32@@ -2030,11 +2049,13 @@
33 # This set of buses is only used once; it's easier to have it
34 # here than to put it elsewhere and have to document its
35 # location and purpose.
36- if bus in (None, 'ac97', 'disk', 'drm', 'drm_minor', 'dvb',
37- 'enclosure', 'gameport', 'graphics', 'hid', 'host',
38- 'hwmon', 'ieee80211', 'link', 'lirc', 'memstick_host',
39- 'net', 'partition', 'pci_express', 'pcmcia_socket',
40- 'scsi_disk', 'scsi_generic', 'scsi_host', 'scsi_target',
41+ if bus in (None, 'ac97', 'bttv-sub', 'disk', 'drm', 'drm_minor',
42+ 'dvb', 'enclosure', 'gameport', 'graphics', 'hid', 'host',
43+ 'hwmon', 'ieee80211', 'link', 'lirc', 'mISDN', 'memstick',
44+ 'memstick_host', 'net', 'partition', 'pci_express',
45+ 'pcmcia_socket', 'pvrusb2', 'sas_device', 'sas_end_device',
46+ 'sas_host', 'sas_phy', 'sas_port', 'scsi_disk',
47+ 'scsi_generic', 'scsi_host', 'scsi_tape', 'scsi_target',
48 'sound', 'spi_host', 'spi_transport', 'ssb', 'tifm',
49 'tifm_adapter', 'tty', 'usb', 'usb-serial', 'usb_endpoint',
50 'usb_host', 'usb_interface', 'usbmon', 'video4linux',
51@@ -2148,8 +2169,9 @@
52
53 raw_bus == 'video_output', 'thermal', 'vtconsole', 'bdi',
54 'mem', 'ppp', 'vc', 'dmi', 'hidraw', 'hwmon', 'heci', 'rfkill',
55- 'i2c-adapter', 'ttm', 'ppdev', 'printer' is used in submissions
56- with udev data for virtual devices.
57+ 'i2c-adapter', 'ttm', 'ppdev', 'printer', 'cardman_4040', 'msr',
58+ 'ieee1394_protocol', 'dahdi', 'atm', 'asus_oled', 'pktcdvd' is
59+ used in submissions with udev data for virtual devices.
60
61 'pci_bus' is used in submissions with udev data for a node
62 describing a PCI bus.
63@@ -2183,11 +2205,13 @@
64 # The root node is course a real device; storing data
65 # about other devices with the bus "unkown" is pointless.
66 return False
67- if bus in ('backlight', 'bdi', 'bluetooth', 'dmi', 'heci', 'hidraw',
68- 'hwmon', 'i2c-adapter', 'ieee1394', 'input', 'leds', 'mem',
69- 'misc', 'mmc', 'mmc_host', 'pci_bus', 'pcmcia', 'platform',
70- 'pnp', 'power_supply', 'ppdev', 'ppp', 'printer', 'rfkill',
71- 'thermal', 'ttm', 'vc', 'video_output', 'vtconsole'):
72+ if bus in ('asus_oled', 'atm', 'backlight', 'bdi', 'bluetooth',
73+ 'cardman_4040', 'dahdi', 'dmi', 'heci', 'hidraw', 'hwmon',
74+ 'i2c-adapter', 'ieee1394', 'ieee1394_protocol', 'input',
75+ 'leds', 'mem', 'misc', 'mmc', 'mmc_host', 'msr', 'pci_bus',
76+ 'pcmcia', 'pktcdvd', 'platform', 'pnp', 'power_supply',
77+ 'ppdev', 'ppp', 'printer', 'rfkill', 'thermal', 'ttm',
78+ 'vc', 'video_output', 'vtconsole'):
79 return False
80
81 # We identify devices by bus, vendor ID and product ID;
82
83=== modified file 'lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py'
84--- lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py 2009-10-26 16:49:19 +0000
85+++ lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py 2009-11-09 09:30:26 +0000
86@@ -1672,14 +1672,16 @@
87 parser = SubmissionParser(self.log)
88
89 ignored_buses = (
90- 'ac97', 'disk', 'drm', 'drm_minor', 'dvb', 'enclosure',
91- 'gameport', 'hid', 'host', 'ieee80211', 'link', 'lirc',
92- 'memstick_host', 'net', 'partition', 'pci_express',
93- 'pcmcia_socket', 'scsi_disk', 'scsi_generic', 'scsi_host',
94+ 'ac97', 'bttv-sub', 'disk', 'drm', 'drm_minor', 'dvb',
95+ 'enclosure', 'gameport', 'graphics', 'hid', 'host', 'hwmon',
96+ 'ieee80211', 'link', 'lirc', 'mISDN', 'memstick', 'memstick_host',
97+ 'net', 'partition', 'pci_express', 'pcmcia_socket', 'pvrusb2',
98+ 'sas_device', 'sas_end_device', 'sas_host', 'sas_phy', 'sas_port',
99+ 'scsi_disk', 'scsi_generic', 'scsi_host', 'scsi_tape',
100 'scsi_target', 'sound', 'spi_host', 'spi_transport', 'ssb',
101 'tifm', 'tifm_adapter', 'tty', 'usb', 'usb-serial',
102- 'usb_endpoint', 'usb_host', 'usb_interface', 'video4linux',
103- 'wlan')
104+ 'usb_endpoint', 'usb_host', 'usb_interface', 'usbmon',
105+ 'video4linux', 'wlan')
106 for tested_bus in ignored_buses:
107 properties['info.bus'] = (tested_bus, 'str')
108 parser.buildHalDeviceList(parsed_data)
109@@ -2010,12 +2012,13 @@
110 }
111 parser = SubmissionParser(self.log)
112 properties = devices[0]['properties']
113- for bus in ('backlight', 'bdi', 'bluetooth', 'dmi', 'heci', 'hidraw',
114- 'hwmon', 'i2c-adapter', 'ieee1394', 'input', 'leds', 'mem',
115- 'misc', 'mmc', 'mmc_host', 'pci_bus', 'pcmcia', 'platform',
116- 'pnp', 'power_supply', 'ppdev', 'ppp', 'printer', 'rfkill',
117- 'thermal', 'ttm', 'unknown', 'vc', 'video_output',
118- 'vtconsole'):
119+ for bus in ('asus_oled', 'atm', 'backlight', 'bdi', 'bluetooth',
120+ 'cardman_4040', 'dahdi', 'dmi', 'heci', 'hidraw',
121+ 'hwmon', 'i2c-adapter', 'ieee1394', 'ieee1394_protocol',
122+ 'input', 'leds', 'mem', 'misc', 'mmc', 'mmc_host', 'msr',
123+ 'pci_bus', 'pcmcia', 'pktcdvd', 'platform', 'pnp',
124+ 'power_supply', 'ppdev', 'ppp', 'printer', 'rfkill',
125+ 'thermal', 'ttm', 'vc', 'video_output', 'vtconsole'):
126 properties['info.bus'] = (bus, 'str')
127 parser.buildHalDeviceList(parsed_data)
128 device = parser.devices[self.UDI_SATA_CONTROLLER]