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
=== modified file 'lib/canonical/launchpad/scripts/hwdbsubmissions.py'
--- lib/canonical/launchpad/scripts/hwdbsubmissions.py 2009-10-27 14:12:10 +0000
+++ lib/canonical/launchpad/scripts/hwdbsubmissions.py 2009-11-09 09:30:26 +0000
@@ -2018,7 +2018,26 @@
20182018
2019 'hwmon' is is used in submissions with udev data in2019 'hwmon' is is used in submissions with udev data in
2020 many sub-nodes.2020 many sub-nodes.
2021 """2021
2022 'sas_phy', 'sas_device', 'sas_end_device', 'sas_port',
2023 'sas_host' is used in submissions with udev data for
2024 details of SAS controllers.
2025
2026 'mISDN' is used in submissions with udev data for the
2027 I/O aspects of ISDN adapters.
2028
2029 'pvrusb2' is used in submissions with udev data for the
2030 input aspect of some DVB adapters.
2031
2032 'memstick' is used in submissions with udev data for the
2033 I/O aspect of memory stick controllers.
2034
2035 'bttv-sub' is used in submissions with udev data for the
2036 I/O aspects of some TV receivers.
2037
2038 'scsi_tape' is used in submissions with udev data for
2039 details of SCSI tape drives.
2040 """
2022 # The root node is always a real device, but its raw_bus2041 # The root node is always a real device, but its raw_bus
2023 # property can have different values: None or 'Unknown' in2042 # property can have different values: None or 'Unknown' in
2024 # submissions with HAL data, 'acpi' for submissions with udev2043 # submissions with HAL data, 'acpi' for submissions with udev
@@ -2030,11 +2049,13 @@
2030 # This set of buses is only used once; it's easier to have it2049 # This set of buses is only used once; it's easier to have it
2031 # here than to put it elsewhere and have to document its2050 # here than to put it elsewhere and have to document its
2032 # location and purpose.2051 # location and purpose.
2033 if bus in (None, 'ac97', 'disk', 'drm', 'drm_minor', 'dvb',2052 if bus in (None, 'ac97', 'bttv-sub', 'disk', 'drm', 'drm_minor',
2034 'enclosure', 'gameport', 'graphics', 'hid', 'host',2053 'dvb', 'enclosure', 'gameport', 'graphics', 'hid', 'host',
2035 'hwmon', 'ieee80211', 'link', 'lirc', 'memstick_host',2054 'hwmon', 'ieee80211', 'link', 'lirc', 'mISDN', 'memstick',
2036 'net', 'partition', 'pci_express', 'pcmcia_socket',2055 'memstick_host', 'net', 'partition', 'pci_express',
2037 'scsi_disk', 'scsi_generic', 'scsi_host', 'scsi_target',2056 'pcmcia_socket', 'pvrusb2', 'sas_device', 'sas_end_device',
2057 'sas_host', 'sas_phy', 'sas_port', 'scsi_disk',
2058 'scsi_generic', 'scsi_host', 'scsi_tape', 'scsi_target',
2038 'sound', 'spi_host', 'spi_transport', 'ssb', 'tifm',2059 'sound', 'spi_host', 'spi_transport', 'ssb', 'tifm',
2039 'tifm_adapter', 'tty', 'usb', 'usb-serial', 'usb_endpoint',2060 'tifm_adapter', 'tty', 'usb', 'usb-serial', 'usb_endpoint',
2040 'usb_host', 'usb_interface', 'usbmon', 'video4linux',2061 'usb_host', 'usb_interface', 'usbmon', 'video4linux',
@@ -2148,8 +2169,9 @@
21482169
2149 raw_bus == 'video_output', 'thermal', 'vtconsole', 'bdi',2170 raw_bus == 'video_output', 'thermal', 'vtconsole', 'bdi',
2150 'mem', 'ppp', 'vc', 'dmi', 'hidraw', 'hwmon', 'heci', 'rfkill',2171 'mem', 'ppp', 'vc', 'dmi', 'hidraw', 'hwmon', 'heci', 'rfkill',
2151 'i2c-adapter', 'ttm', 'ppdev', 'printer' is used in submissions2172 'i2c-adapter', 'ttm', 'ppdev', 'printer', 'cardman_4040', 'msr',
2152 with udev data for virtual devices.2173 'ieee1394_protocol', 'dahdi', 'atm', 'asus_oled', 'pktcdvd' is
2174 used in submissions with udev data for virtual devices.
21532175
2154 'pci_bus' is used in submissions with udev data for a node2176 'pci_bus' is used in submissions with udev data for a node
2155 describing a PCI bus.2177 describing a PCI bus.
@@ -2183,11 +2205,13 @@
2183 # The root node is course a real device; storing data2205 # The root node is course a real device; storing data
2184 # about other devices with the bus "unkown" is pointless.2206 # about other devices with the bus "unkown" is pointless.
2185 return False2207 return False
2186 if bus in ('backlight', 'bdi', 'bluetooth', 'dmi', 'heci', 'hidraw',2208 if bus in ('asus_oled', 'atm', 'backlight', 'bdi', 'bluetooth',
2187 'hwmon', 'i2c-adapter', 'ieee1394', 'input', 'leds', 'mem',2209 'cardman_4040', 'dahdi', 'dmi', 'heci', 'hidraw', 'hwmon',
2188 'misc', 'mmc', 'mmc_host', 'pci_bus', 'pcmcia', 'platform',2210 'i2c-adapter', 'ieee1394', 'ieee1394_protocol', 'input',
2189 'pnp', 'power_supply', 'ppdev', 'ppp', 'printer', 'rfkill',2211 'leds', 'mem', 'misc', 'mmc', 'mmc_host', 'msr', 'pci_bus',
2190 'thermal', 'ttm', 'vc', 'video_output', 'vtconsole'):2212 'pcmcia', 'pktcdvd', 'platform', 'pnp', 'power_supply',
2213 'ppdev', 'ppp', 'printer', 'rfkill', 'thermal', 'ttm',
2214 'vc', 'video_output', 'vtconsole'):
2191 return False2215 return False
21922216
2193 # We identify devices by bus, vendor ID and product ID;2217 # We identify devices by bus, vendor ID and product ID;
21942218
=== modified file 'lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py'
--- lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py 2009-10-26 16:49:19 +0000
+++ lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py 2009-11-09 09:30:26 +0000
@@ -1672,14 +1672,16 @@
1672 parser = SubmissionParser(self.log)1672 parser = SubmissionParser(self.log)
16731673
1674 ignored_buses = (1674 ignored_buses = (
1675 'ac97', 'disk', 'drm', 'drm_minor', 'dvb', 'enclosure',1675 'ac97', 'bttv-sub', 'disk', 'drm', 'drm_minor', 'dvb',
1676 'gameport', 'hid', 'host', 'ieee80211', 'link', 'lirc',1676 'enclosure', 'gameport', 'graphics', 'hid', 'host', 'hwmon',
1677 'memstick_host', 'net', 'partition', 'pci_express',1677 'ieee80211', 'link', 'lirc', 'mISDN', 'memstick', 'memstick_host',
1678 'pcmcia_socket', 'scsi_disk', 'scsi_generic', 'scsi_host',1678 'net', 'partition', 'pci_express', 'pcmcia_socket', 'pvrusb2',
1679 'sas_device', 'sas_end_device', 'sas_host', 'sas_phy', 'sas_port',
1680 'scsi_disk', 'scsi_generic', 'scsi_host', 'scsi_tape',
1679 'scsi_target', 'sound', 'spi_host', 'spi_transport', 'ssb',1681 'scsi_target', 'sound', 'spi_host', 'spi_transport', 'ssb',
1680 'tifm', 'tifm_adapter', 'tty', 'usb', 'usb-serial',1682 'tifm', 'tifm_adapter', 'tty', 'usb', 'usb-serial',
1681 'usb_endpoint', 'usb_host', 'usb_interface', 'video4linux',1683 'usb_endpoint', 'usb_host', 'usb_interface', 'usbmon',
1682 'wlan')1684 'video4linux', 'wlan')
1683 for tested_bus in ignored_buses:1685 for tested_bus in ignored_buses:
1684 properties['info.bus'] = (tested_bus, 'str')1686 properties['info.bus'] = (tested_bus, 'str')
1685 parser.buildHalDeviceList(parsed_data)1687 parser.buildHalDeviceList(parsed_data)
@@ -2010,12 +2012,13 @@
2010 }2012 }
2011 parser = SubmissionParser(self.log)2013 parser = SubmissionParser(self.log)
2012 properties = devices[0]['properties']2014 properties = devices[0]['properties']
2013 for bus in ('backlight', 'bdi', 'bluetooth', 'dmi', 'heci', 'hidraw',2015 for bus in ('asus_oled', 'atm', 'backlight', 'bdi', 'bluetooth',
2014 'hwmon', 'i2c-adapter', 'ieee1394', 'input', 'leds', 'mem',2016 'cardman_4040', 'dahdi', 'dmi', 'heci', 'hidraw',
2015 'misc', 'mmc', 'mmc_host', 'pci_bus', 'pcmcia', 'platform',2017 'hwmon', 'i2c-adapter', 'ieee1394', 'ieee1394_protocol',
2016 'pnp', 'power_supply', 'ppdev', 'ppp', 'printer', 'rfkill',2018 'input', 'leds', 'mem', 'misc', 'mmc', 'mmc_host', 'msr',
2017 'thermal', 'ttm', 'unknown', 'vc', 'video_output',2019 'pci_bus', 'pcmcia', 'pktcdvd', 'platform', 'pnp',
2018 'vtconsole'):2020 'power_supply', 'ppdev', 'ppp', 'printer', 'rfkill',
2021 'thermal', 'ttm', 'vc', 'video_output', 'vtconsole'):
2019 properties['info.bus'] = (bus, 'str')2022 properties['info.bus'] = (bus, 'str')
2020 parser.buildHalDeviceList(parsed_data)2023 parser.buildHalDeviceList(parsed_data)
2021 device = parser.devices[self.UDI_SATA_CONTROLLER]2024 device = parser.devices[self.UDI_SATA_CONTROLLER]