Merge lp:~adeuring/launchpad/hwdb-class-udev-device-7 into lp:launchpad
- hwdb-class-udev-device-7
- Merge into devel
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~adeuring/launchpad/hwdb-class-udev-device-7 |
Merge into: | lp:launchpad |
Diff against target: |
1070 lines 2 files modified
lib/canonical/launchpad/scripts/hwdbsubmissions.py (+83/-26) lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py (+702/-70) |
To merge this branch: | bzr merge lp:~adeuring/launchpad/hwdb-class-udev-device-7 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Nelson (community) | code | Approve | |
Review via email: mp+13413@code.launchpad.net |
Commit message
Description of the change
Abel Deuring (adeuring) wrote : | # |
Michael Nelson (michael.nelson) wrote : | # |
Great! The addition of the is_root_device property makes the code much
more readable.
As usual, just one or two comments below, in particular, one change for which I couldn't see the cause...
Thanks!
> === modified file 'lib/canonical/
> --- lib/canonical/
> +++ lib/canonical/
> @@ -1644,7 +1644,7 @@
> return None
> pci_subclass = scsi_controller
> return self.pci_
> - elif scsi_controller_bus == 'usb':
> + elif scsi_controller_bus in ('usb', 'usb_interface'):
> # USB storage devices have the following HAL device hierarchy:
> # - HAL node for the USB device. info.bus == 'usb_device',
> # device class == 0, device subclass == 0
> @@ -1703,6 +1703,12 @@
> return HWBus.PCI
>
> @property
> + def is_root_
> + """Return True is this is the root node of all devicese, else False.
> + """
> + raise NotImplementedError
> +
> + @property
> def raw_bus(self):
> """Return the device bus as specified by HAL or udev."""
> raise NotImplementedError
> @@ -1719,11 +1725,11 @@
> if result is not None:
> return result
>
> - if device_bus == 'scsi':
> + if device_bus in ('scsi', 'scsi_device'):
> return self.translateS
> elif device_bus == 'pci':
> return self.translateP
> - elif self.udi == ROOT_UDI:
> + elif self.is_
> # The computer itself. In Hardy, HAL provides no info.bus
> # for the machine itself; older versions set info.bus to
> # 'unknown', hence it is better to use the machine's
> @@ -1731,7 +1737,7 @@
> return HWBus.SYSTEM
> else:
> self.parser.
> - 'Unknown bus %r for device %s' % (device_bus, self.udi))
> + 'Unknown bus %r for device %s' % (device_bus, self.device_id))
> return None
>
> @property
> @@ -2275,6 +2281,11 @@
> return result
> return self.getPropert
>
> + @property
> + def is_root_
> + """See `BaseDevice`."""
> + return self.udi == ROOT_UDI
> +
> def getVendorOrProd
> """Return the vendor or product of this device.
>
> @@ -2547,7 +2558,7 @@
> # DEVTYPE. DEVTYPE is preferable.
> # The root device has the subsystem/bus value "acpi", which
> # is a bit nonsensical.
> - if self.device_id == UDEV_ROOT_PATH:
> + if self.is_
> return None
> properties = self.udev['E']
> devtype = properties.
> @@ -2555,6 +2566,11 @@
> return devtype
> return properties.
>
> + @property
> + def is_root_
> + """See `BaseDevice`."""
> + return self.udev[...
Abel Deuring (adeuring) wrote : | # |
Hi Michael,
thanks for your review!
> Great! The addition of the is_root_device property makes the code much
> more readable.
>
> As usual, just one or two comments below, in particular, one change for which
> I couldn't see the cause...
>
> Thanks!
>
> > === modified file 'lib/canonical/
> > --- lib/canonical/
> 13:22:14 +0000
> > +++ lib/canonical/
> 13:59:33 +0000
> > @@ -1644,7 +1644,7 @@
> > return None
> > pci_subclass = scsi_controller
> > return self.pci_
> > - elif scsi_controller_bus == 'usb':
> > + elif scsi_controller_bus in ('usb', 'usb_interface'):
> > # USB storage devices have the following HAL device hierarchy:
> > # - HAL node for the USB device. info.bus == 'usb_device',
> > # device class == 0, device subclass == 0
> > @@ -1703,6 +1703,12 @@
> > return HWBus.PCI
> >
> > @property
> > + def is_root_
> > + """Return True is this is the root node of all devicese, else
> False.
> > + """
> > + raise NotImplementedError
> > +
> > + @property
> > def raw_bus(self):
> > """Return the device bus as specified by HAL or udev."""
> > raise NotImplementedError
> > @@ -1719,11 +1725,11 @@
> > if result is not None:
> > return result
> >
> > - if device_bus == 'scsi':
> > + if device_bus in ('scsi', 'scsi_device'):
> > return self.translateS
> > elif device_bus == 'pci':
> > return self.translateP
> > - elif self.udi == ROOT_UDI:
> > + elif self.is_
> > # The computer itself. In Hardy, HAL provides no info.bus
> > # for the machine itself; older versions set info.bus to
> > # 'unknown', hence it is better to use the machine's
> > @@ -1731,7 +1737,7 @@
> > return HWBus.SYSTEM
> > else:
> > self.parser.
> > - 'Unknown bus %r for device %s' % (device_bus, self.udi))
> > + 'Unknown bus %r for device %s' % (device_bus,
> self.device_id))
> > return None
> >
> > @property
> > @@ -2275,6 +2281,11 @@
> > return result
> > return self.getPropert
> >
> > + @property
> > + def is_root_
> > + """See `BaseDevice`."""
> > + return self.udi == ROOT_UDI
> > +
> > def getVendorOrProd
> > """Return the vendor or product of this device.
> >
> > @@ -2547,7 +2558,7 @@
> > # DEVTYPE. DEVTYPE is preferable.
> > # The root device has the subsystem/bus value "acpi", which
> > # is a bit nonsensical.
> > - if self.device_id == UDEV_ROOT_PATH:
> > + if self.is_
> > return None
> > properties = self.udev['E']
> > devtype = properties.
> > @@ -2555,6...
Preview Diff
1 | === modified file 'lib/canonical/launchpad/scripts/hwdbsubmissions.py' | |||
2 | --- lib/canonical/launchpad/scripts/hwdbsubmissions.py 2009-10-13 21:03:31 +0000 | |||
3 | +++ lib/canonical/launchpad/scripts/hwdbsubmissions.py 2009-10-15 17:00:35 +0000 | |||
4 | @@ -87,12 +87,14 @@ | |||
5 | 87 | 'pci': '0x%04x', | 87 | 'pci': '0x%04x', |
6 | 88 | 'usb_device': '0x%04x', | 88 | 'usb_device': '0x%04x', |
7 | 89 | 'scsi': '%-8s', | 89 | 'scsi': '%-8s', |
8 | 90 | 'scsi_device': '%-8s', | ||
9 | 90 | } | 91 | } |
10 | 91 | 92 | ||
11 | 92 | DB_FORMAT_FOR_PRODUCT_ID = { | 93 | DB_FORMAT_FOR_PRODUCT_ID = { |
12 | 93 | 'pci': '0x%04x', | 94 | 'pci': '0x%04x', |
13 | 94 | 'usb_device': '0x%04x', | 95 | 'usb_device': '0x%04x', |
14 | 95 | 'scsi': '%-16s', | 96 | 'scsi': '%-16s', |
15 | 97 | 'scsi_device': '%-16s', | ||
16 | 96 | } | 98 | } |
17 | 97 | 99 | ||
18 | 98 | UDEV_USB_DEVICE_PROPERTIES = set(('DEVTYPE', 'PRODUCT', 'TYPE')) | 100 | UDEV_USB_DEVICE_PROPERTIES = set(('DEVTYPE', 'PRODUCT', 'TYPE')) |
19 | @@ -1609,6 +1611,11 @@ | |||
20 | 1609 | """The name of the driver contolling this device. May be None.""" | 1611 | """The name of the driver contolling this device. May be None.""" |
21 | 1610 | raise NotImplementedError | 1612 | raise NotImplementedError |
22 | 1611 | 1613 | ||
23 | 1614 | @property | ||
24 | 1615 | def scsi_controller(self): | ||
25 | 1616 | """Return the SCSI host controller for this device.""" | ||
26 | 1617 | raise NotImplementedError | ||
27 | 1618 | |||
28 | 1612 | def translateScsiBus(self): | 1619 | def translateScsiBus(self): |
29 | 1613 | """Return the real bus of a device where raw_bus=='scsi'. | 1620 | """Return the real bus of a device where raw_bus=='scsi'. |
30 | 1614 | 1621 | ||
31 | @@ -1617,37 +1624,27 @@ | |||
32 | 1617 | for more details. This method determines the real bus | 1624 | for more details. This method determines the real bus |
33 | 1618 | of a device accessed via the kernel's SCSI subsystem. | 1625 | of a device accessed via the kernel's SCSI subsystem. |
34 | 1619 | """ | 1626 | """ |
48 | 1620 | # While SCSI devices from valid submissions should have a | 1627 | scsi_controller = self.scsi_controller |
49 | 1621 | # parent and a grandparent, we can't be sure for bogus or | 1628 | if scsi_controller is None: |
37 | 1622 | # broken submissions. | ||
38 | 1623 | parent = self.parent | ||
39 | 1624 | if parent is None: | ||
40 | 1625 | self.parser._logWarning( | ||
41 | 1626 | 'Found SCSI device without a parent: %s.' % self.device_id) | ||
42 | 1627 | return None | ||
43 | 1628 | grandparent = parent.parent | ||
44 | 1629 | if grandparent is None: | ||
45 | 1630 | self.parser._logWarning( | ||
46 | 1631 | 'Found SCSI device without a grandparent: %s.' | ||
47 | 1632 | % self.device_id) | ||
50 | 1633 | return None | 1629 | return None |
51 | 1634 | 1630 | ||
55 | 1635 | grandparent_bus = grandparent.raw_bus | 1631 | scsi_controller_bus = scsi_controller.raw_bus |
56 | 1636 | if grandparent_bus == 'pci': | 1632 | if scsi_controller_bus == 'pci': |
57 | 1637 | if (grandparent.pci_class != PCI_CLASS_STORAGE): | 1633 | if (scsi_controller.pci_class != PCI_CLASS_STORAGE): |
58 | 1638 | # This is not a storage class PCI device? This | 1634 | # This is not a storage class PCI device? This |
59 | 1639 | # indicates a bug somewhere in HAL or in the hwdb | 1635 | # indicates a bug somewhere in HAL or in the hwdb |
60 | 1640 | # client, or a fake submission. | 1636 | # client, or a fake submission. |
62 | 1641 | device_class = grandparent.pci_class | 1637 | device_class = scsi_controller.pci_class |
63 | 1642 | self.parser._logWarning( | 1638 | self.parser._logWarning( |
64 | 1643 | 'A (possibly fake) SCSI device %s is connected to ' | 1639 | 'A (possibly fake) SCSI device %s is connected to ' |
65 | 1644 | 'PCI device %s that has the PCI device class %s; ' | 1640 | 'PCI device %s that has the PCI device class %s; ' |
66 | 1645 | 'expected class 1 (storage).' | 1641 | 'expected class 1 (storage).' |
68 | 1646 | % (self.device_id, grandparent.device_id, device_class)) | 1642 | % (self.device_id, scsi_controller.device_id, |
69 | 1643 | device_class)) | ||
70 | 1647 | return None | 1644 | return None |
72 | 1648 | pci_subclass = grandparent.pci_subclass | 1645 | pci_subclass = scsi_controller.pci_subclass |
73 | 1649 | return self.pci_storage_subclass_hwbus.get(pci_subclass) | 1646 | return self.pci_storage_subclass_hwbus.get(pci_subclass) |
75 | 1650 | elif grandparent_bus == 'usb': | 1647 | elif scsi_controller_bus in ('usb', 'usb_interface'): |
76 | 1651 | # USB storage devices have the following HAL device hierarchy: | 1648 | # USB storage devices have the following HAL device hierarchy: |
77 | 1652 | # - HAL node for the USB device. info.bus == 'usb_device', | 1649 | # - HAL node for the USB device. info.bus == 'usb_device', |
78 | 1653 | # device class == 0, device subclass == 0 | 1650 | # device class == 0, device subclass == 0 |
79 | @@ -1706,6 +1703,12 @@ | |||
80 | 1706 | return HWBus.PCI | 1703 | return HWBus.PCI |
81 | 1707 | 1704 | ||
82 | 1708 | @property | 1705 | @property |
83 | 1706 | def is_root_device(self): | ||
84 | 1707 | """Return True is this is the root node of all devicese, else False. | ||
85 | 1708 | """ | ||
86 | 1709 | raise NotImplementedError | ||
87 | 1710 | |||
88 | 1711 | @property | ||
89 | 1709 | def raw_bus(self): | 1712 | def raw_bus(self): |
90 | 1710 | """Return the device bus as specified by HAL or udev.""" | 1713 | """Return the device bus as specified by HAL or udev.""" |
91 | 1711 | raise NotImplementedError | 1714 | raise NotImplementedError |
92 | @@ -1722,11 +1725,11 @@ | |||
93 | 1722 | if result is not None: | 1725 | if result is not None: |
94 | 1723 | return result | 1726 | return result |
95 | 1724 | 1727 | ||
97 | 1725 | if device_bus == 'scsi': | 1728 | if device_bus in ('scsi', 'scsi_device'): |
98 | 1726 | return self.translateScsiBus() | 1729 | return self.translateScsiBus() |
99 | 1727 | elif device_bus == 'pci': | 1730 | elif device_bus == 'pci': |
100 | 1728 | return self.translatePciBus() | 1731 | return self.translatePciBus() |
102 | 1729 | elif self.udi == ROOT_UDI: | 1732 | elif self.is_root_device: |
103 | 1730 | # The computer itself. In Hardy, HAL provides no info.bus | 1733 | # The computer itself. In Hardy, HAL provides no info.bus |
104 | 1731 | # for the machine itself; older versions set info.bus to | 1734 | # for the machine itself; older versions set info.bus to |
105 | 1732 | # 'unknown', hence it is better to use the machine's | 1735 | # 'unknown', hence it is better to use the machine's |
106 | @@ -1734,7 +1737,7 @@ | |||
107 | 1734 | return HWBus.SYSTEM | 1737 | return HWBus.SYSTEM |
108 | 1735 | else: | 1738 | else: |
109 | 1736 | self.parser._logWarning( | 1739 | self.parser._logWarning( |
111 | 1737 | 'Unknown bus %r for device %s' % (device_bus, self.udi)) | 1740 | 'Unknown bus %r for device %s' % (device_bus, self.device_id)) |
112 | 1738 | return None | 1741 | return None |
113 | 1739 | 1742 | ||
114 | 1740 | @property | 1743 | @property |
115 | @@ -2278,6 +2281,11 @@ | |||
116 | 2278 | return result | 2281 | return result |
117 | 2279 | return self.getProperty('info.subsystem') | 2282 | return self.getProperty('info.subsystem') |
118 | 2280 | 2283 | ||
119 | 2284 | @property | ||
120 | 2285 | def is_root_device(self): | ||
121 | 2286 | """See `BaseDevice`.""" | ||
122 | 2287 | return self.udi == ROOT_UDI | ||
123 | 2288 | |||
124 | 2281 | def getVendorOrProduct(self, type_): | 2289 | def getVendorOrProduct(self, type_): |
125 | 2282 | """Return the vendor or product of this device. | 2290 | """Return the vendor or product of this device. |
126 | 2283 | 2291 | ||
127 | @@ -2357,6 +2365,27 @@ | |||
128 | 2357 | """See `BaseDevice`.""" | 2365 | """See `BaseDevice`.""" |
129 | 2358 | return self.getVendorOrProductID('product') | 2366 | return self.getVendorOrProductID('product') |
130 | 2359 | 2367 | ||
131 | 2368 | @property | ||
132 | 2369 | def scsi_controller(self): | ||
133 | 2370 | """See `BaseDevice`.""" | ||
134 | 2371 | # While SCSI devices from valid submissions should have a | ||
135 | 2372 | # parent and a grandparent, we can't be sure for bogus or | ||
136 | 2373 | # broken submissions. | ||
137 | 2374 | if self.raw_bus != 'scsi': | ||
138 | 2375 | return None | ||
139 | 2376 | parent = self.parent | ||
140 | 2377 | if parent is None: | ||
141 | 2378 | self.parser._logWarning( | ||
142 | 2379 | 'Found SCSI device without a parent: %s.' % self.device_id) | ||
143 | 2380 | return None | ||
144 | 2381 | grandparent = parent.parent | ||
145 | 2382 | if grandparent is None: | ||
146 | 2383 | self.parser._logWarning( | ||
147 | 2384 | 'Found SCSI device without a grandparent: %s.' | ||
148 | 2385 | % self.device_id) | ||
149 | 2386 | return None | ||
150 | 2387 | return grandparent | ||
151 | 2388 | |||
152 | 2360 | 2389 | ||
153 | 2361 | class UdevDevice(BaseDevice): | 2390 | class UdevDevice(BaseDevice): |
154 | 2362 | """The representation of a udev device node.""" | 2391 | """The representation of a udev device node.""" |
155 | @@ -2529,7 +2558,7 @@ | |||
156 | 2529 | # DEVTYPE. DEVTYPE is preferable. | 2558 | # DEVTYPE. DEVTYPE is preferable. |
157 | 2530 | # The root device has the subsystem/bus value "acpi", which | 2559 | # The root device has the subsystem/bus value "acpi", which |
158 | 2531 | # is a bit nonsensical. | 2560 | # is a bit nonsensical. |
160 | 2532 | if self.device_id == UDEV_ROOT_PATH: | 2561 | if self.is_root_device: |
161 | 2533 | return None | 2562 | return None |
162 | 2534 | properties = self.udev['E'] | 2563 | properties = self.udev['E'] |
163 | 2535 | devtype = properties.get('DEVTYPE') | 2564 | devtype = properties.get('DEVTYPE') |
164 | @@ -2537,6 +2566,11 @@ | |||
165 | 2537 | return devtype | 2566 | return devtype |
166 | 2538 | return properties.get('SUBSYSTEM') | 2567 | return properties.get('SUBSYSTEM') |
167 | 2539 | 2568 | ||
168 | 2569 | @property | ||
169 | 2570 | def is_root_device(self): | ||
170 | 2571 | """See `BaseDevice`.""" | ||
171 | 2572 | return self.udev['P'] == UDEV_ROOT_PATH | ||
172 | 2573 | |||
173 | 2540 | def getVendorOrProduct(self, type_): | 2574 | def getVendorOrProduct(self, type_): |
174 | 2541 | """Return the vendor or product of this device. | 2575 | """Return the vendor or product of this device. |
175 | 2542 | 2576 | ||
176 | @@ -2547,7 +2581,7 @@ | |||
177 | 2547 | 'Unexpected value of type_: %r' % type_) | 2581 | 'Unexpected value of type_: %r' % type_) |
178 | 2548 | 2582 | ||
179 | 2549 | bus = self.raw_bus | 2583 | bus = self.raw_bus |
181 | 2550 | if self.device_id == UDEV_ROOT_PATH: | 2584 | if self.is_root_device: |
182 | 2551 | # udev does not known about any product information for | 2585 | # udev does not known about any product information for |
183 | 2552 | # the root device. We use DMI data instead. | 2586 | # the root device. We use DMI data instead. |
184 | 2553 | return self.root_device_ids[type_] | 2587 | return self.root_device_ids[type_] |
185 | @@ -2587,7 +2621,7 @@ | |||
186 | 2587 | 'Unexpected value of type_: %r' % type_) | 2621 | 'Unexpected value of type_: %r' % type_) |
187 | 2588 | 2622 | ||
188 | 2589 | bus = self.raw_bus | 2623 | bus = self.raw_bus |
190 | 2590 | if self.device_id == UDEV_ROOT_PATH: | 2624 | if self.is_root_device: |
191 | 2591 | # udev does not known about any product information for | 2625 | # udev does not known about any product information for |
192 | 2592 | # the root device. We use DMI data instead. | 2626 | # the root device. We use DMI data instead. |
193 | 2593 | if type_ == 'vendor': | 2627 | if type_ == 'vendor': |
194 | @@ -2617,6 +2651,29 @@ | |||
195 | 2617 | """See `BaseDevice`.""" | 2651 | """See `BaseDevice`.""" |
196 | 2618 | return self.getVendorOrProductID('product') | 2652 | return self.getVendorOrProductID('product') |
197 | 2619 | 2653 | ||
198 | 2654 | @property | ||
199 | 2655 | def driver_name(self): | ||
200 | 2656 | """See `BaseDevice`.""" | ||
201 | 2657 | return self.udev['E'].get('DRIVER') | ||
202 | 2658 | |||
203 | 2659 | @property | ||
204 | 2660 | def scsi_controller(self): | ||
205 | 2661 | """See `BaseDevice`.""" | ||
206 | 2662 | if self.raw_bus != 'scsi_device': | ||
207 | 2663 | return None | ||
208 | 2664 | |||
209 | 2665 | # While SCSI devices from valid submissions should have four | ||
210 | 2666 | # ancestors, we can't be sure for bogus or broken submissions. | ||
211 | 2667 | try: | ||
212 | 2668 | controller = self.parent.parent.parent.parent | ||
213 | 2669 | except AttributeError: | ||
214 | 2670 | controller = None | ||
215 | 2671 | if controller is None: | ||
216 | 2672 | self.parser._logWarning( | ||
217 | 2673 | 'Found a SCSI device without a sufficient number of ' | ||
218 | 2674 | 'ancestors: %s' % self.device_id) | ||
219 | 2675 | return None | ||
220 | 2676 | return controller | ||
221 | 2620 | 2677 | ||
222 | 2621 | class ProcessingLoop(object): | 2678 | class ProcessingLoop(object): |
223 | 2622 | """An `ITunableLoop` for processing HWDB submissions.""" | 2679 | """An `ITunableLoop` for processing HWDB submissions.""" |
224 | 2623 | 2680 | ||
225 | === modified file 'lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py' | |||
226 | --- lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py 2009-10-13 21:02:35 +0000 | |||
227 | +++ lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py 2009-10-15 17:00:35 +0000 | |||
228 | @@ -539,6 +539,214 @@ | |||
229 | 539 | 'HAL property info.bus.') | 539 | 'HAL property info.bus.') |
230 | 540 | 540 | ||
231 | 541 | 541 | ||
232 | 542 | def test_HALDevice_scsi_controller_usb_storage_device(self): | ||
233 | 543 | """test of HALDevice.scsi_controller. | ||
234 | 544 | |||
235 | 545 | The physical device is a USB storage device. | ||
236 | 546 | """ | ||
237 | 547 | devices = [ | ||
238 | 548 | # The main node of the USB storage device. | ||
239 | 549 | { | ||
240 | 550 | 'id': 1, | ||
241 | 551 | 'udi': self.UDI_USB_STORAGE, | ||
242 | 552 | 'properties': { | ||
243 | 553 | 'info.bus': ('usb_device', 'str'), | ||
244 | 554 | }, | ||
245 | 555 | }, | ||
246 | 556 | # The storage interface of the USB device. | ||
247 | 557 | { | ||
248 | 558 | 'id': 2, | ||
249 | 559 | 'udi': self.UDI_USB_STORAGE_IF0, | ||
250 | 560 | 'properties': { | ||
251 | 561 | 'info.bus': ('usb', 'str'), | ||
252 | 562 | 'info.parent': (self.UDI_USB_STORAGE, 'str'), | ||
253 | 563 | }, | ||
254 | 564 | }, | ||
255 | 565 | # The fake SCSI host of the storage device. Note that HAL does | ||
256 | 566 | # _not_ provide the info.bus property. | ||
257 | 567 | { | ||
258 | 568 | 'id': 3, | ||
259 | 569 | 'udi': self.UDI_USB_STORAGE_SCSI_HOST, | ||
260 | 570 | 'properties': { | ||
261 | 571 | 'info.parent': (self.UDI_USB_STORAGE_IF0, 'str'), | ||
262 | 572 | }, | ||
263 | 573 | }, | ||
264 | 574 | # The fake SCSI disk. | ||
265 | 575 | { | ||
266 | 576 | 'id': 3, | ||
267 | 577 | 'udi': self.UDI_USB_STORAGE_SCSI_DEVICE, | ||
268 | 578 | 'properties': { | ||
269 | 579 | 'info.bus': ('scsi', 'str'), | ||
270 | 580 | 'info.parent': (self.UDI_USB_STORAGE_SCSI_HOST, 'str'), | ||
271 | 581 | }, | ||
272 | 582 | }, | ||
273 | 583 | ] | ||
274 | 584 | parsed_data = { | ||
275 | 585 | 'hardware': { | ||
276 | 586 | 'hal': { | ||
277 | 587 | 'devices': devices, | ||
278 | 588 | }, | ||
279 | 589 | }, | ||
280 | 590 | } | ||
281 | 591 | |||
282 | 592 | parser = SubmissionParser() | ||
283 | 593 | parser.buildDeviceList(parsed_data) | ||
284 | 594 | |||
285 | 595 | usb_fake_scsi_disk = parser.hal_devices[ | ||
286 | 596 | self.UDI_USB_STORAGE_SCSI_DEVICE] | ||
287 | 597 | usb_main_device = parser.hal_devices[self.UDI_USB_STORAGE_IF0] | ||
288 | 598 | self.assertEqual(usb_main_device, usb_fake_scsi_disk.scsi_controller) | ||
289 | 599 | |||
290 | 600 | def test_HALDevice_scsi_controller_pci_controller(self): | ||
291 | 601 | """test of HALDevice.scsi_controller. | ||
292 | 602 | |||
293 | 603 | Variant for a SCSI device connected to a PCI controller. | ||
294 | 604 | """ | ||
295 | 605 | devices = [ | ||
296 | 606 | # The PCI host controller. | ||
297 | 607 | { | ||
298 | 608 | 'id': 1, | ||
299 | 609 | 'udi': self.UDI_SATA_CONTROLLER, | ||
300 | 610 | 'properties': { | ||
301 | 611 | 'info.bus': ('pci', 'str'), | ||
302 | 612 | 'pci.device_class': (PCI_CLASS_STORAGE, 'int'), | ||
303 | 613 | 'pci.device_subclass': (PCI_SUBCLASS_STORAGE_SATA, | ||
304 | 614 | 'int'), | ||
305 | 615 | }, | ||
306 | 616 | }, | ||
307 | 617 | # The (fake or real) SCSI host of the storage device. | ||
308 | 618 | { | ||
309 | 619 | 'id': 2, | ||
310 | 620 | 'udi': self.UDI_SATA_CONTROLLER_SCSI, | ||
311 | 621 | 'properties': { | ||
312 | 622 | 'info.parent': (self.UDI_SATA_CONTROLLER, 'str'), | ||
313 | 623 | }, | ||
314 | 624 | }, | ||
315 | 625 | # The (possibly fake) SCSI disk. | ||
316 | 626 | { | ||
317 | 627 | 'id': 3, | ||
318 | 628 | 'udi': self.UDI_SATA_DISK, | ||
319 | 629 | 'properties': { | ||
320 | 630 | 'info.bus': ('scsi', 'str'), | ||
321 | 631 | 'info.parent': (self.UDI_SATA_CONTROLLER_SCSI, 'str'), | ||
322 | 632 | }, | ||
323 | 633 | }, | ||
324 | 634 | ] | ||
325 | 635 | parsed_data = { | ||
326 | 636 | 'hardware': { | ||
327 | 637 | 'hal': { | ||
328 | 638 | 'devices': devices, | ||
329 | 639 | }, | ||
330 | 640 | }, | ||
331 | 641 | } | ||
332 | 642 | |||
333 | 643 | parser = SubmissionParser() | ||
334 | 644 | parser.buildDeviceList(parsed_data) | ||
335 | 645 | |||
336 | 646 | scsi_device = parser.hal_devices[self.UDI_SATA_DISK] | ||
337 | 647 | controller = parser.hal_devices[self.UDI_SATA_CONTROLLER] | ||
338 | 648 | self.assertEqual(controller, scsi_device.scsi_controller) | ||
339 | 649 | |||
340 | 650 | def test_HALDevice_scsi_controller_non_scsi_device(self): | ||
341 | 651 | """test of HALDevice.scsi_controller. | ||
342 | 652 | |||
343 | 653 | Variant for non-SCSI devices. | ||
344 | 654 | """ | ||
345 | 655 | devices = [ | ||
346 | 656 | { | ||
347 | 657 | 'id': 1, | ||
348 | 658 | 'udi': self.UDI_COMPUTER, | ||
349 | 659 | 'properties': {}, | ||
350 | 660 | }, | ||
351 | 661 | ] | ||
352 | 662 | parsed_data = { | ||
353 | 663 | 'hardware': { | ||
354 | 664 | 'hal': { | ||
355 | 665 | 'devices': devices, | ||
356 | 666 | }, | ||
357 | 667 | }, | ||
358 | 668 | } | ||
359 | 669 | |||
360 | 670 | parser = SubmissionParser() | ||
361 | 671 | parser.buildDeviceList(parsed_data) | ||
362 | 672 | |||
363 | 673 | device = parser.hal_devices[self.UDI_COMPUTER] | ||
364 | 674 | self.assertEqual(None, device.scsi_controller) | ||
365 | 675 | |||
366 | 676 | def test_HALDevice_scsi_controller_no_grandparent(self): | ||
367 | 677 | """test of HALDevice.scsi_controller. | ||
368 | 678 | |||
369 | 679 | Variant for a SCSI device without a grandparent device. | ||
370 | 680 | """ | ||
371 | 681 | devices = [ | ||
372 | 682 | # The (fake or real) SCSI host of the storage device. | ||
373 | 683 | { | ||
374 | 684 | 'id': 1, | ||
375 | 685 | 'udi': self.UDI_SATA_CONTROLLER_SCSI, | ||
376 | 686 | 'properties': {}, | ||
377 | 687 | }, | ||
378 | 688 | # The (possibly fake) SCSI disk. | ||
379 | 689 | { | ||
380 | 690 | 'id': 2, | ||
381 | 691 | 'udi': self.UDI_SATA_DISK, | ||
382 | 692 | 'properties': { | ||
383 | 693 | 'info.bus': ('scsi', 'str'), | ||
384 | 694 | 'info.parent': (self.UDI_SATA_CONTROLLER_SCSI, 'str'), | ||
385 | 695 | }, | ||
386 | 696 | }, | ||
387 | 697 | ] | ||
388 | 698 | parsed_data = { | ||
389 | 699 | 'hardware': { | ||
390 | 700 | 'hal': { | ||
391 | 701 | 'devices': devices, | ||
392 | 702 | }, | ||
393 | 703 | }, | ||
394 | 704 | } | ||
395 | 705 | |||
396 | 706 | parser = SubmissionParser(self.log) | ||
397 | 707 | parser.submission_key = 'SCSI device without grandparent device' | ||
398 | 708 | parser.buildDeviceList(parsed_data) | ||
399 | 709 | |||
400 | 710 | scsi_device = parser.hal_devices[self.UDI_SATA_DISK] | ||
401 | 711 | self.assertEqual(None, scsi_device.scsi_controller) | ||
402 | 712 | self.assertWarningMessage( | ||
403 | 713 | parser.submission_key, | ||
404 | 714 | "Found SCSI device without a grandparent: %s." | ||
405 | 715 | % self.UDI_SATA_DISK) | ||
406 | 716 | |||
407 | 717 | def test_HALDevice_scsi_controller_no_parent(self): | ||
408 | 718 | """test of HALDevice.scsi_controller. | ||
409 | 719 | |||
410 | 720 | Variant for a SCSI device without a parent device. | ||
411 | 721 | """ | ||
412 | 722 | devices = [ | ||
413 | 723 | # The (possibly fake) SCSI disk. | ||
414 | 724 | { | ||
415 | 725 | 'id': 1, | ||
416 | 726 | 'udi': self.UDI_SATA_DISK, | ||
417 | 727 | 'properties': { | ||
418 | 728 | 'info.bus': ('scsi', 'str'), | ||
419 | 729 | }, | ||
420 | 730 | }, | ||
421 | 731 | ] | ||
422 | 732 | parsed_data = { | ||
423 | 733 | 'hardware': { | ||
424 | 734 | 'hal': { | ||
425 | 735 | 'devices': devices, | ||
426 | 736 | }, | ||
427 | 737 | }, | ||
428 | 738 | } | ||
429 | 739 | |||
430 | 740 | parser = SubmissionParser(self.log) | ||
431 | 741 | parser.submission_key = 'SCSI device without parent device' | ||
432 | 742 | parser.buildDeviceList(parsed_data) | ||
433 | 743 | |||
434 | 744 | scsi_device = parser.hal_devices[self.UDI_SATA_DISK] | ||
435 | 745 | self.assertEqual(None, scsi_device.scsi_controller) | ||
436 | 746 | self.assertWarningMessage( | ||
437 | 747 | parser.submission_key, | ||
438 | 748 | "Found SCSI device without a parent: %s." % self.UDI_SATA_DISK) | ||
439 | 749 | |||
440 | 542 | def testHALDeviceGetRealBus(self): | 750 | def testHALDeviceGetRealBus(self): |
441 | 543 | """Test of HALDevice.real_bus, generic case. | 751 | """Test of HALDevice.real_bus, generic case. |
442 | 544 | 752 | ||
443 | @@ -965,6 +1173,51 @@ | |||
444 | 965 | parser.submission_key, | 1173 | parser.submission_key, |
445 | 966 | "Unknown bus 'nonsense' for device " + self.UDI_PCCARD_DEVICE) | 1174 | "Unknown bus 'nonsense' for device " + self.UDI_PCCARD_DEVICE) |
446 | 967 | 1175 | ||
447 | 1176 | def test_HALDevice_is_root_device_for_root_device(self): | ||
448 | 1177 | """Test of HALDevice.is_root_device for the root device.""" | ||
449 | 1178 | devices = [ | ||
450 | 1179 | { | ||
451 | 1180 | 'id': 1, | ||
452 | 1181 | 'udi': self.UDI_COMPUTER, | ||
453 | 1182 | 'properties': {}, | ||
454 | 1183 | }, | ||
455 | 1184 | ] | ||
456 | 1185 | parsed_data = { | ||
457 | 1186 | 'hardware': { | ||
458 | 1187 | 'hal': { | ||
459 | 1188 | 'devices': devices, | ||
460 | 1189 | }, | ||
461 | 1190 | }, | ||
462 | 1191 | } | ||
463 | 1192 | |||
464 | 1193 | parser = SubmissionParser() | ||
465 | 1194 | parser.submission_key = 'Test of HALDevice.is_root_device' | ||
466 | 1195 | parser.buildDeviceList(parsed_data) | ||
467 | 1196 | self.assertTrue(parser.hal_devices[self.UDI_COMPUTER].is_root_device) | ||
468 | 1197 | |||
469 | 1198 | def test_HALDevice_is_root_device_for_non_root_device(self): | ||
470 | 1199 | """Test of HALDevice.is_root_device for a non-root device.""" | ||
471 | 1200 | devices = [ | ||
472 | 1201 | { | ||
473 | 1202 | 'id': 1, | ||
474 | 1203 | 'udi': self.UDI_PCCARD_DEVICE, | ||
475 | 1204 | 'properties': {}, | ||
476 | 1205 | }, | ||
477 | 1206 | ] | ||
478 | 1207 | parsed_data = { | ||
479 | 1208 | 'hardware': { | ||
480 | 1209 | 'hal': { | ||
481 | 1210 | 'devices': devices, | ||
482 | 1211 | }, | ||
483 | 1212 | }, | ||
484 | 1213 | } | ||
485 | 1214 | |||
486 | 1215 | parser = SubmissionParser() | ||
487 | 1216 | parser.submission_key = 'Test of HALDevice.is_root_device' | ||
488 | 1217 | parser.buildDeviceList(parsed_data) | ||
489 | 1218 | self.assertFalse( | ||
490 | 1219 | parser.hal_devices[self.UDI_PCCARD_DEVICE].is_root_device) | ||
491 | 1220 | |||
492 | 968 | def renameInfoBusToInfoSubsystem(self, devices): | 1221 | def renameInfoBusToInfoSubsystem(self, devices): |
493 | 969 | """Rename the property info.bus in a device list to info.subsystem. | 1222 | """Rename the property info.bus in a device list to info.subsystem. |
494 | 970 | 1223 | ||
495 | @@ -2585,65 +2838,260 @@ | |||
496 | 2585 | 'property not treated as a real device.') | 2838 | 'property not treated as a real device.') |
497 | 2586 | 2839 | ||
498 | 2587 | 2840 | ||
500 | 2588 | class TestUdevDevice(TestCase): | 2841 | class TestUdevDevice(TestCaseHWDB): |
501 | 2589 | """Tests of class UdevDevice.""" | 2842 | """Tests of class UdevDevice.""" |
502 | 2590 | 2843 | ||
559 | 2591 | layer = BaseLayer | 2844 | def setUp(self): |
560 | 2592 | 2845 | """Setup the test environment.""" | |
561 | 2593 | root_device = { | 2846 | super(TestUdevDevice, self).setUp() |
562 | 2594 | 'P': '/devices/LNXSYSTM:00', | 2847 | self.root_device = { |
563 | 2595 | 'E': { | 2848 | 'P': '/devices/LNXSYSTM:00', |
564 | 2596 | 'UDEV_LOG': '3', | 2849 | 'E': { |
565 | 2597 | 'DEVPATH': '/devices/LNXSYSTM:00', | 2850 | 'UDEV_LOG': '3', |
566 | 2598 | 'MODALIAS': 'acpi:LNXSYSTM:', | 2851 | 'DEVPATH': '/devices/LNXSYSTM:00', |
567 | 2599 | 'SUBSYSTEM': 'acpi', | 2852 | 'MODALIAS': 'acpi:LNXSYSTM:', |
568 | 2600 | } | 2853 | 'SUBSYSTEM': 'acpi', |
569 | 2601 | } | 2854 | } |
570 | 2602 | 2855 | } | |
571 | 2603 | root_device_dmi_data = { | 2856 | |
572 | 2604 | '/sys/class/dmi/id/sys_vendor': 'FUJITSU SIEMENS', | 2857 | self.root_device_dmi_data = { |
573 | 2605 | '/sys/class/dmi/id/product_name': 'LIFEBOOK E8210', | 2858 | '/sys/class/dmi/id/sys_vendor': 'FUJITSU SIEMENS', |
574 | 2606 | } | 2859 | '/sys/class/dmi/id/product_name': 'LIFEBOOK E8210', |
575 | 2607 | 2860 | } | |
576 | 2608 | pci_device_data = { | 2861 | |
577 | 2609 | 'P': '/devices/pci0000:00/0000:00:1f.2', | 2862 | self.pci_device_data = { |
578 | 2610 | 'E': { | 2863 | 'P': '/devices/pci0000:00/0000:00:1f.2', |
579 | 2611 | 'PCI_CLASS': '10602', | 2864 | 'E': { |
580 | 2612 | 'PCI_ID': '8086:27C5', | 2865 | 'PCI_CLASS': '10602', |
581 | 2613 | 'PCI_SUBSYS_ID': '10CF:1387', | 2866 | 'PCI_ID': '8086:27C5', |
582 | 2614 | 'PCI_SLOT_NAME': '0000:00:1f.2', | 2867 | 'PCI_SUBSYS_ID': '10CF:1387', |
583 | 2615 | 'SUBSYSTEM': 'pci', | 2868 | 'PCI_SLOT_NAME': '0000:00:1f.2', |
584 | 2616 | } | 2869 | 'SUBSYSTEM': 'pci', |
585 | 2617 | } | 2870 | 'DRIVER': 'ahci', |
586 | 2618 | 2871 | } | |
587 | 2619 | usb_device_data = { | 2872 | } |
588 | 2620 | 'P': '/devices/pci0000:00/0000:00:1d.1/usb3/3-2', | 2873 | |
589 | 2621 | 'E': { | 2874 | self.usb_device_data = { |
590 | 2622 | 'SUBSYSTEM': 'usb', | 2875 | 'P': '/devices/pci0000:00/0000:00:1d.1/usb3/3-2', |
591 | 2623 | 'DEVTYPE': 'usb_device', | 2876 | 'E': { |
592 | 2624 | 'PRODUCT': '46d/a01/1013', | 2877 | 'SUBSYSTEM': 'usb', |
593 | 2625 | 'TYPE': '0/0/0', | 2878 | 'DEVTYPE': 'usb_device', |
594 | 2626 | }, | 2879 | 'PRODUCT': '46d/a01/1013', |
595 | 2627 | } | 2880 | 'TYPE': '0/0/0', |
596 | 2628 | 2881 | 'DRIVER': 'usb', | |
597 | 2629 | scsi_device_data = { | 2882 | }, |
598 | 2630 | 'P': '/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0', | 2883 | } |
599 | 2631 | 'E': { | 2884 | |
600 | 2632 | 'SUBSYSTEM': 'scsi', | 2885 | self.pci_pccard_bridge = { |
601 | 2633 | 'DEVTYPE': 'scsi_device', | 2886 | 'P': '/devices/pci0000:00/0000:00:1e.0/0000:08:03.0', |
602 | 2634 | }, | 2887 | 'E': { |
603 | 2635 | } | 2888 | 'DRIVER': 'yenta_cardbus', |
604 | 2636 | 2889 | 'PCI_CLASS': '60700', | |
605 | 2637 | scsi_device_sysfs_data = { | 2890 | 'PCI_ID': '1217:7134', |
606 | 2638 | 'vendor': 'MATSHITA', | 2891 | 'PCI_SUBSYS_ID': '10CF:131E', |
607 | 2639 | 'model': 'DVD-RAM UJ-841S', | 2892 | 'PCI_SLOT_NAME': '0000:08:03.0', |
608 | 2640 | 'type': '5', | 2893 | 'SUBSYSTEM': 'pci', |
609 | 2641 | } | 2894 | } |
610 | 2642 | 2895 | } | |
611 | 2643 | no_subsystem_device_data = { | 2896 | |
612 | 2644 | 'P': '/devices/pnp0/00:00', | 2897 | self.pccard_scsi_controller_data = { |
613 | 2645 | 'E': {} | 2898 | 'P': '/devices/pci0000:00/0000:00:1e.0/0000:08:03.0/0000:09:00.0', |
614 | 2646 | } | 2899 | 'E': { |
615 | 2900 | 'DRIVER': 'aic7xxx', | ||
616 | 2901 | 'PCI_CLASS': '10000', | ||
617 | 2902 | 'PCI_ID': '9004:6075', | ||
618 | 2903 | 'PCI_SUBSYS_ID': '9004:7560', | ||
619 | 2904 | 'SUBSYSTEM': 'pci', | ||
620 | 2905 | }, | ||
621 | 2906 | } | ||
622 | 2907 | |||
623 | 2908 | self.pci_scsi_controller_scsi_side_1 = { | ||
624 | 2909 | 'P': ('/devices/pci0000:00/0000:00:1e.0/0000:08:03.0/' | ||
625 | 2910 | '0000:09:00.0/host6'), | ||
626 | 2911 | 'E': { | ||
627 | 2912 | 'DEVTYPE': 'scsi_host', | ||
628 | 2913 | 'SUBSYSTEM': 'scsi', | ||
629 | 2914 | }, | ||
630 | 2915 | } | ||
631 | 2916 | |||
632 | 2917 | self.pci_bridge_pccard_hierarchy_data = [ | ||
633 | 2918 | {'udev_data': self.root_device}, | ||
634 | 2919 | {'udev_data': self.pci_pccard_bridge}, | ||
635 | 2920 | {'udev_data': self.pccard_scsi_controller_data}, | ||
636 | 2921 | ] | ||
637 | 2922 | |||
638 | 2923 | self.pci_scsi_controller_scsi_side_2 = { | ||
639 | 2924 | 'P': ('/devices/pci0000:00/0000:00:1e.0/0000:08:03.0/' | ||
640 | 2925 | '0000:09:00.0/host6/scsi_host/host6'), | ||
641 | 2926 | 'E': { | ||
642 | 2927 | 'SUBSYSTEM': 'scsi_host', | ||
643 | 2928 | }, | ||
644 | 2929 | } | ||
645 | 2930 | |||
646 | 2931 | self.scsi_scanner_target_data = { | ||
647 | 2932 | 'P': ('/devices/pci0000:00/0000:00:1e.0/0000:08:03.0/' | ||
648 | 2933 | '0000:09:00.0/host6/target6:0:1'), | ||
649 | 2934 | 'E': { | ||
650 | 2935 | 'DEVTYPE': 'scsi_target', | ||
651 | 2936 | 'SUBSYSTEM': 'scsi' | ||
652 | 2937 | }, | ||
653 | 2938 | } | ||
654 | 2939 | |||
655 | 2940 | self.scsi_scanner_device_data = { | ||
656 | 2941 | 'P': ('/devices/pci0000:00/0000:00:1e.0/0000:08:03.0/' | ||
657 | 2942 | '0000:09:00.0/host6/target6:0:1/6:0:1:0'), | ||
658 | 2943 | 'E': { | ||
659 | 2944 | 'DEVTYPE': 'scsi_device', | ||
660 | 2945 | 'SUBSYSTEM': 'scsi', | ||
661 | 2946 | }, | ||
662 | 2947 | } | ||
663 | 2948 | |||
664 | 2949 | self.scsi_scanner_device_sysfs_data = { | ||
665 | 2950 | 'vendor': 'FUJITSU', | ||
666 | 2951 | 'model': 'fi-5120Cdj', | ||
667 | 2952 | 'type': '6', | ||
668 | 2953 | } | ||
669 | 2954 | |||
670 | 2955 | self.scsi_device_hierarchy_data = [ | ||
671 | 2956 | {'udev_data': self.pccard_scsi_controller_data}, | ||
672 | 2957 | {'udev_data': self.pci_scsi_controller_scsi_side_1}, | ||
673 | 2958 | {'udev_data': self.pci_scsi_controller_scsi_side_2}, | ||
674 | 2959 | {'udev_data': self.scsi_scanner_target_data}, | ||
675 | 2960 | { | ||
676 | 2961 | 'udev_data': self.scsi_scanner_device_data, | ||
677 | 2962 | 'sysfs_data': self.scsi_scanner_device_sysfs_data, | ||
678 | 2963 | }, | ||
679 | 2964 | ] | ||
680 | 2965 | |||
681 | 2966 | self.pci_ide_controller = { | ||
682 | 2967 | 'P': '/devices/pci0000:00/0000:00:1f.1', | ||
683 | 2968 | 'E': { | ||
684 | 2969 | 'DRIVER': 'ata_piix', | ||
685 | 2970 | 'PCI_CLASS': '1018A', | ||
686 | 2971 | 'PCI_ID': '8086:27DF', | ||
687 | 2972 | 'PCI_SUBSYS_ID': '10CF:1385', | ||
688 | 2973 | 'SUBSYSTEM': 'pci', | ||
689 | 2974 | }, | ||
690 | 2975 | } | ||
691 | 2976 | |||
692 | 2977 | self.pci_ide_controller_scsi_side_1 = { | ||
693 | 2978 | 'P': '/devices/pci0000:00/0000:00:1f.1/host4', | ||
694 | 2979 | 'E': { | ||
695 | 2980 | 'DEVTYPE': 'scsi_host', | ||
696 | 2981 | 'SUBSYSTEM': 'scsi', | ||
697 | 2982 | }, | ||
698 | 2983 | } | ||
699 | 2984 | |||
700 | 2985 | self.pci_ide_controller_scsi_side_2 = { | ||
701 | 2986 | 'P': '/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4', | ||
702 | 2987 | 'E': { | ||
703 | 2988 | 'SUBSYSTEM': 'scsi_host', | ||
704 | 2989 | }, | ||
705 | 2990 | } | ||
706 | 2991 | |||
707 | 2992 | self.ide_device_target_data = { | ||
708 | 2993 | 'P': '/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0', | ||
709 | 2994 | 'E': { | ||
710 | 2995 | 'DEVTYPE': 'scsi_target', | ||
711 | 2996 | 'SUBSYSTEM': 'scsi', | ||
712 | 2997 | }, | ||
713 | 2998 | } | ||
714 | 2999 | |||
715 | 3000 | self.ide_cdrom_device_data = { | ||
716 | 3001 | 'P': ('/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/' | ||
717 | 3002 | '4:0:0:0'), | ||
718 | 3003 | 'E': { | ||
719 | 3004 | 'SUBSYSTEM': 'scsi', | ||
720 | 3005 | 'DEVTYPE': 'scsi_device', | ||
721 | 3006 | 'DRIVER': 'sr', | ||
722 | 3007 | }, | ||
723 | 3008 | } | ||
724 | 3009 | |||
725 | 3010 | self.ide_cdrom_device_sysfs_data = { | ||
726 | 3011 | 'vendor': 'MATSHITA', | ||
727 | 3012 | 'model': 'DVD-RAM UJ-841S', | ||
728 | 3013 | 'type': '5', | ||
729 | 3014 | } | ||
730 | 3015 | |||
731 | 3016 | self.ide_device_hierarchy_data = [ | ||
732 | 3017 | {'udev_data': self.pci_ide_controller}, | ||
733 | 3018 | {'udev_data': self.pci_ide_controller_scsi_side_1}, | ||
734 | 3019 | {'udev_data': self.pci_ide_controller_scsi_side_2}, | ||
735 | 3020 | {'udev_data': self.ide_device_target_data}, | ||
736 | 3021 | { | ||
737 | 3022 | 'udev_data': self.ide_cdrom_device_data, | ||
738 | 3023 | 'sysfs_data': self.ide_cdrom_device_sysfs_data, | ||
739 | 3024 | }, | ||
740 | 3025 | ] | ||
741 | 3026 | |||
742 | 3027 | self.usb_storage_usb_interface = { | ||
743 | 3028 | 'P': '/devices/pci0000:00/0000:00:1d.7/usb1/1-1/1-1:1.0', | ||
744 | 3029 | 'E': { | ||
745 | 3030 | 'DRIVER': 'usb-storage', | ||
746 | 3031 | 'PRODUCT': '1307/163/100', | ||
747 | 3032 | 'TYPE': '0/0/0', | ||
748 | 3033 | 'INTERFACE': '8/6/80', | ||
749 | 3034 | 'DEVTYPE': 'usb_interface', | ||
750 | 3035 | 'SUBSYSTEM': 'usb', | ||
751 | 3036 | }, | ||
752 | 3037 | } | ||
753 | 3038 | |||
754 | 3039 | self.usb_storage_scsi_host_1 = { | ||
755 | 3040 | 'P': '/devices/pci0000:00/0000:00:1d.7/usb1/1-1/1-1:1.0/host7', | ||
756 | 3041 | 'E': { | ||
757 | 3042 | 'DEVTYPE': 'scsi_host', | ||
758 | 3043 | 'SUBSYSTEM': 'scsi', | ||
759 | 3044 | }, | ||
760 | 3045 | } | ||
761 | 3046 | |||
762 | 3047 | self.usb_storage_scsi_host_2 = { | ||
763 | 3048 | 'P': ('/devices/pci0000:00/0000:00:1d.7/usb1/1-1/1-1:1.0/host7/' | ||
764 | 3049 | 'scsi_host/host7'), | ||
765 | 3050 | 'E': { | ||
766 | 3051 | 'SUBSYSTEM': 'scsi_host', | ||
767 | 3052 | }, | ||
768 | 3053 | } | ||
769 | 3054 | |||
770 | 3055 | self.usb_storage_scsi_target = { | ||
771 | 3056 | 'P': ('/devices/pci0000:00/0000:00:1d.7/usb1/1-1/1-1:1.0/host7/' | ||
772 | 3057 | 'target7:0:0'), | ||
773 | 3058 | 'E': { | ||
774 | 3059 | 'DEVTYPE': 'scsi_target', | ||
775 | 3060 | 'SUBSYSTEM': 'scsi', | ||
776 | 3061 | }, | ||
777 | 3062 | } | ||
778 | 3063 | |||
779 | 3064 | self.usb_storage_scsi_device = { | ||
780 | 3065 | 'P': ('/devices/pci0000:00/0000:00:1d.7/usb1/1-1/1-1:1.0/host7/' | ||
781 | 3066 | 'target7:0:0/7:0:0:0'), | ||
782 | 3067 | 'E': { | ||
783 | 3068 | 'DEVTYPE': 'scsi_device', | ||
784 | 3069 | 'DRIVER': 'sd', | ||
785 | 3070 | 'SUBSYSTEM': 'scsi', | ||
786 | 3071 | }, | ||
787 | 3072 | } | ||
788 | 3073 | |||
789 | 3074 | self.usb_storage_scsi_device_sysfs = { | ||
790 | 3075 | 'vendor': 'Ut163', | ||
791 | 3076 | 'model': 'USB2FlashStorage', | ||
792 | 3077 | 'type': '0', | ||
793 | 3078 | } | ||
794 | 3079 | |||
795 | 3080 | self.usb_storage_hierarchy_data = [ | ||
796 | 3081 | {'udev_data': self.usb_storage_usb_interface}, | ||
797 | 3082 | {'udev_data': self.usb_storage_scsi_host_1}, | ||
798 | 3083 | {'udev_data': self.usb_storage_scsi_host_2}, | ||
799 | 3084 | {'udev_data': self.usb_storage_scsi_target}, | ||
800 | 3085 | { | ||
801 | 3086 | 'udev_data': self.usb_storage_scsi_device, | ||
802 | 3087 | 'sysfs_data': self.usb_storage_scsi_device_sysfs, | ||
803 | 3088 | }, | ||
804 | 3089 | ] | ||
805 | 3090 | |||
806 | 3091 | self.no_subsystem_device_data = { | ||
807 | 3092 | 'P': '/devices/pnp0/00:00', | ||
808 | 3093 | 'E': {} | ||
809 | 3094 | } | ||
810 | 2647 | 3095 | ||
811 | 2648 | def test_device_id(self): | 3096 | def test_device_id(self): |
812 | 2649 | """Test of UdevDevice.device_id.""" | 3097 | """Test of UdevDevice.device_id.""" |
813 | @@ -2790,7 +3238,8 @@ | |||
814 | 2790 | def test_is_scsi_device(self): | 3238 | def test_is_scsi_device(self): |
815 | 2791 | """Test of UdevDevice.is_scsi_device.""" | 3239 | """Test of UdevDevice.is_scsi_device.""" |
816 | 2792 | device = UdevDevice( | 3240 | device = UdevDevice( |
818 | 2793 | None, self.scsi_device_data, self.scsi_device_sysfs_data) | 3241 | None, self.scsi_scanner_device_data, |
819 | 3242 | self.scsi_scanner_device_sysfs_data) | ||
820 | 2794 | self.assertTrue(device.is_scsi_device) | 3243 | self.assertTrue(device.is_scsi_device) |
821 | 2795 | 3244 | ||
822 | 2796 | device = UdevDevice(None, self.root_device) | 3245 | device = UdevDevice(None, self.root_device) |
823 | @@ -2799,16 +3248,18 @@ | |||
824 | 2799 | def test_scsi_vendor(self): | 3248 | def test_scsi_vendor(self): |
825 | 2800 | """Test of UdevDevice.scsi_vendor.""" | 3249 | """Test of UdevDevice.scsi_vendor.""" |
826 | 2801 | device = UdevDevice( | 3250 | device = UdevDevice( |
829 | 2802 | None, self.scsi_device_data, self.scsi_device_sysfs_data, None) | 3251 | None, self.scsi_scanner_device_data, |
830 | 2803 | self.assertEqual('MATSHITA', device.scsi_vendor) | 3252 | self.scsi_scanner_device_sysfs_data) |
831 | 3253 | self.assertEqual('FUJITSU', device.scsi_vendor) | ||
832 | 2804 | device = UdevDevice(None, self.root_device) | 3254 | device = UdevDevice(None, self.root_device) |
833 | 2805 | self.assertEqual(None, device.scsi_vendor) | 3255 | self.assertEqual(None, device.scsi_vendor) |
834 | 2806 | 3256 | ||
835 | 2807 | def test_scsi_model(self): | 3257 | def test_scsi_model(self): |
836 | 2808 | """Test of UdevDevice.scsi_model.""" | 3258 | """Test of UdevDevice.scsi_model.""" |
837 | 2809 | device = UdevDevice( | 3259 | device = UdevDevice( |
840 | 2810 | None, self.scsi_device_data, self.scsi_device_sysfs_data) | 3260 | None, self.scsi_scanner_device_data, |
841 | 2811 | self.assertEqual('DVD-RAM UJ-841S', device.scsi_model) | 3261 | self.scsi_scanner_device_sysfs_data) |
842 | 3262 | self.assertEqual('fi-5120Cdj', device.scsi_model) | ||
843 | 2812 | 3263 | ||
844 | 2813 | device = UdevDevice(None, self.root_device) | 3264 | device = UdevDevice(None, self.root_device) |
845 | 2814 | self.assertEqual(None, device.scsi_model) | 3265 | self.assertEqual(None, device.scsi_model) |
846 | @@ -2827,6 +3278,14 @@ | |||
847 | 2827 | device = UdevDevice(None, self.no_subsystem_device_data) | 3278 | device = UdevDevice(None, self.no_subsystem_device_data) |
848 | 2828 | self.assertEqual(None, device.raw_bus) | 3279 | self.assertEqual(None, device.raw_bus) |
849 | 2829 | 3280 | ||
850 | 3281 | def test_is_root_device(self): | ||
851 | 3282 | """Test of UdevDevice.is_root_device.""" | ||
852 | 3283 | device = UdevDevice(None, self.root_device) | ||
853 | 3284 | self.assertTrue(device.is_root_device) | ||
854 | 3285 | |||
855 | 3286 | device = UdevDevice(None, self.pci_device_data) | ||
856 | 3287 | self.assertFalse(device.is_root_device) | ||
857 | 3288 | |||
858 | 2830 | def test_getVendorOrProduct(self): | 3289 | def test_getVendorOrProduct(self): |
859 | 2831 | """Test of UdevDevice.getVendorOrProduct().""" | 3290 | """Test of UdevDevice.getVendorOrProduct().""" |
860 | 2832 | device = UdevDevice( | 3291 | device = UdevDevice( |
861 | @@ -2847,10 +3306,10 @@ | |||
862 | 2847 | self.assertEqual('Unknown', device.getVendorOrProduct('product')) | 3306 | self.assertEqual('Unknown', device.getVendorOrProduct('product')) |
863 | 2848 | 3307 | ||
864 | 2849 | device = UdevDevice( | 3308 | device = UdevDevice( |
869 | 2850 | None, self.scsi_device_data, self.scsi_device_sysfs_data) | 3309 | None, self.scsi_scanner_device_data, |
870 | 2851 | self.assertEqual('MATSHITA', device.getVendorOrProduct('vendor')) | 3310 | self.scsi_scanner_device_sysfs_data) |
871 | 2852 | self.assertEqual( | 3311 | self.assertEqual('FUJITSU', device.getVendorOrProduct('vendor')) |
872 | 2853 | 'DVD-RAM UJ-841S', device.getVendorOrProduct('product')) | 3312 | self.assertEqual('fi-5120Cdj', device.getVendorOrProduct('product')) |
873 | 2854 | 3313 | ||
874 | 2855 | device = UdevDevice(None, self.no_subsystem_device_data) | 3314 | device = UdevDevice(None, self.no_subsystem_device_data) |
875 | 2856 | self.assertEqual(None, device.getVendorOrProduct('vendor')) | 3315 | self.assertEqual(None, device.getVendorOrProduct('vendor')) |
876 | @@ -2888,10 +3347,10 @@ | |||
877 | 2888 | self.assertEqual(0xa01, device.getVendorOrProductID('product')) | 3347 | self.assertEqual(0xa01, device.getVendorOrProductID('product')) |
878 | 2889 | 3348 | ||
879 | 2890 | device = UdevDevice( | 3349 | device = UdevDevice( |
884 | 2891 | None, self.scsi_device_data, self.scsi_device_sysfs_data) | 3350 | None, self.scsi_scanner_device_data, |
885 | 2892 | self.assertEqual('MATSHITA', device.getVendorOrProductID('vendor')) | 3351 | self.scsi_scanner_device_sysfs_data) |
886 | 2893 | self.assertEqual( | 3352 | self.assertEqual('FUJITSU', device.getVendorOrProductID('vendor')) |
887 | 2894 | 'DVD-RAM UJ-841S', device.getVendorOrProductID('product')) | 3353 | self.assertEqual('fi-5120Cdj', device.getVendorOrProductID('product')) |
888 | 2895 | 3354 | ||
889 | 2896 | device = UdevDevice( | 3355 | device = UdevDevice( |
890 | 2897 | None, self.no_subsystem_device_data) | 3356 | None, self.no_subsystem_device_data) |
891 | @@ -2910,6 +3369,179 @@ | |||
892 | 2910 | None, self.root_device, None, self.root_device_dmi_data) | 3369 | None, self.root_device, None, self.root_device_dmi_data) |
893 | 2911 | self.assertEqual('LIFEBOOK E8210', device.product_id) | 3370 | self.assertEqual('LIFEBOOK E8210', device.product_id) |
894 | 2912 | 3371 | ||
895 | 3372 | def test_vendor_id_for_db(self): | ||
896 | 3373 | """Test of UdevDevice.vendor_id_for_db.""" | ||
897 | 3374 | device = UdevDevice( | ||
898 | 3375 | None, self.root_device, None, self.root_device_dmi_data) | ||
899 | 3376 | self.assertEqual('FUJITSU SIEMENS', device.vendor_id_for_db) | ||
900 | 3377 | |||
901 | 3378 | device = UdevDevice(None, self.pci_device_data) | ||
902 | 3379 | self.assertEqual('0x8086', device.vendor_id_for_db) | ||
903 | 3380 | |||
904 | 3381 | device = UdevDevice(None, self.usb_device_data) | ||
905 | 3382 | self.assertEqual('0x046d', device.vendor_id_for_db) | ||
906 | 3383 | |||
907 | 3384 | device = UdevDevice( | ||
908 | 3385 | None, self.scsi_scanner_device_data, | ||
909 | 3386 | self.scsi_scanner_device_sysfs_data) | ||
910 | 3387 | self.assertEqual('FUJITSU ', device.vendor_id_for_db) | ||
911 | 3388 | |||
912 | 3389 | def test_product_id_for_db(self): | ||
913 | 3390 | """Test of UdevDevice.product_id_for_db.""" | ||
914 | 3391 | device = UdevDevice( | ||
915 | 3392 | None, self.root_device, None, self.root_device_dmi_data) | ||
916 | 3393 | self.assertEqual('LIFEBOOK E8210', device.product_id_for_db) | ||
917 | 3394 | |||
918 | 3395 | device = UdevDevice(None, self.pci_device_data) | ||
919 | 3396 | self.assertEqual('0x27c5', device.product_id_for_db) | ||
920 | 3397 | |||
921 | 3398 | device = UdevDevice(None, self.usb_device_data) | ||
922 | 3399 | self.assertEqual('0x0a01', device.product_id_for_db) | ||
923 | 3400 | |||
924 | 3401 | device = UdevDevice( | ||
925 | 3402 | None, self.scsi_scanner_device_data, | ||
926 | 3403 | self.scsi_scanner_device_sysfs_data) | ||
927 | 3404 | self.assertEqual('fi-5120Cdj ', device.product_id_for_db) | ||
928 | 3405 | |||
929 | 3406 | def test_driver_name(self): | ||
930 | 3407 | """Test of UdevDevice.driver_name.""" | ||
931 | 3408 | device = UdevDevice(None, self.pci_device_data) | ||
932 | 3409 | self.assertEqual('ahci', device.driver_name) | ||
933 | 3410 | |||
934 | 3411 | device = UdevDevice( | ||
935 | 3412 | None, self.root_device, None, self.root_device_dmi_data) | ||
936 | 3413 | self.assertEqual(None, device.driver_name) | ||
937 | 3414 | |||
938 | 3415 | def buildUdevDeviceHierarchy(self, device_data, parser=None): | ||
939 | 3416 | """Build a UdevDevice hierarchy from device_data. | ||
940 | 3417 | |||
941 | 3418 | :param device_data: A sequence of arguments that are passed | ||
942 | 3419 | to the UdevDevice constructor. Each element must be a | ||
943 | 3420 | dictionary that can be used as a **kwargs argument. | ||
944 | 3421 | |||
945 | 3422 | Element N of the sequence is the parent of element N+1. | ||
946 | 3423 | :param parser: A SubmissionParser instance to be passed to | ||
947 | 3424 | the constructor of UdevDevice. | ||
948 | 3425 | """ | ||
949 | 3426 | parent = None | ||
950 | 3427 | devices = [] | ||
951 | 3428 | for kwargs in device_data: | ||
952 | 3429 | device = UdevDevice(parser, **kwargs) | ||
953 | 3430 | devices.append(device) | ||
954 | 3431 | if parent is not None: | ||
955 | 3432 | parent.addChild(device) | ||
956 | 3433 | parent = device | ||
957 | 3434 | return devices | ||
958 | 3435 | |||
959 | 3436 | def test_scsi_controller(self): | ||
960 | 3437 | """Test of UdevDevice.scsi_controller for a PCI controller.""" | ||
961 | 3438 | devices = self.buildUdevDeviceHierarchy( | ||
962 | 3439 | self.scsi_device_hierarchy_data) | ||
963 | 3440 | controller = devices[0] | ||
964 | 3441 | scsi_device = devices[-1] | ||
965 | 3442 | self.assertEqual(controller, scsi_device.scsi_controller) | ||
966 | 3443 | |||
967 | 3444 | def test_scsi_controller_insufficient_anchestors(self): | ||
968 | 3445 | """Test of UdevDevice.scsi_controller for a PCI controller. | ||
969 | 3446 | |||
970 | 3447 | If a SCSI device does not have a sufficient number of ancestors, | ||
971 | 3448 | UdevDevice.scsi_controller returns None. | ||
972 | 3449 | """ | ||
973 | 3450 | parser = SubmissionParser(self.log) | ||
974 | 3451 | parser.submission_key = 'UdevDevice.scsi_controller ancestor missing' | ||
975 | 3452 | devices = self.buildUdevDeviceHierarchy( | ||
976 | 3453 | self.scsi_device_hierarchy_data[1:], parser) | ||
977 | 3454 | scsi_device = devices[-1] | ||
978 | 3455 | self.assertEqual(None, scsi_device.scsi_controller) | ||
979 | 3456 | self.assertWarningMessage( | ||
980 | 3457 | parser.submission_key, | ||
981 | 3458 | 'Found a SCSI device without a sufficient number of ancestors: ' | ||
982 | 3459 | '/devices/pci0000:00/0000:00:1e.0/0000:08:03.0/0000:09:00.0/' | ||
983 | 3460 | 'host6/target6:0:1/6:0:1:0') | ||
984 | 3461 | |||
985 | 3462 | def test_scsi_controller_no_scsi_device(self): | ||
986 | 3463 | """Test of UdevDevice.scsi_controller for a PCI controller. | ||
987 | 3464 | |||
988 | 3465 | For non-SCSI devices, this property is None. | ||
989 | 3466 | """ | ||
990 | 3467 | device = UdevDevice(None, self.pci_device_data) | ||
991 | 3468 | self.assertEqual(None, device.scsi_controller) | ||
992 | 3469 | |||
993 | 3470 | def test_translateScsiBus_real_scsi_device(self): | ||
994 | 3471 | """Test of UdevDevice.translateScsiBus() with a real SCSI device.""" | ||
995 | 3472 | devices = self.buildUdevDeviceHierarchy( | ||
996 | 3473 | self.scsi_device_hierarchy_data) | ||
997 | 3474 | scsi_device = devices[-1] | ||
998 | 3475 | self.assertEqual( | ||
999 | 3476 | HWBus.SCSI, scsi_device.translateScsiBus()) | ||
1000 | 3477 | |||
1001 | 3478 | def test_translateScsiBus_ide_device(self): | ||
1002 | 3479 | """Test of UdevDevice.translateScsiBus() with an IDE device.""" | ||
1003 | 3480 | devices = self.buildUdevDeviceHierarchy( | ||
1004 | 3481 | self.ide_device_hierarchy_data) | ||
1005 | 3482 | ide_device = devices[-1] | ||
1006 | 3483 | self.assertEqual(HWBus.IDE, ide_device.translateScsiBus()) | ||
1007 | 3484 | |||
1008 | 3485 | def test_translateScsiBus_usb_device(self): | ||
1009 | 3486 | """Test of UdevDevice.translateScsiBus() with a USB device.""" | ||
1010 | 3487 | devices = self.buildUdevDeviceHierarchy( | ||
1011 | 3488 | self.usb_storage_hierarchy_data) | ||
1012 | 3489 | usb_scsi_device = devices[-1] | ||
1013 | 3490 | self.assertEqual(None, usb_scsi_device.translateScsiBus()) | ||
1014 | 3491 | |||
1015 | 3492 | def test_translateScsiBus_non_scsi_device(self): | ||
1016 | 3493 | """Test of UdevDevice.translateScsiBus() for a non-SCSI device.""" | ||
1017 | 3494 | device = UdevDevice(None, self.root_device) | ||
1018 | 3495 | self.assertEqual(None, device.translateScsiBus()) | ||
1019 | 3496 | |||
1020 | 3497 | def test_translatePciBus(self): | ||
1021 | 3498 | """Test of UdevDevice.translatePciBus().""" | ||
1022 | 3499 | devices = self.buildUdevDeviceHierarchy( | ||
1023 | 3500 | self.pci_bridge_pccard_hierarchy_data) | ||
1024 | 3501 | pci_device = devices[1] | ||
1025 | 3502 | pccard_device = devices[2] | ||
1026 | 3503 | self.assertEqual(HWBus.PCI, pci_device.translatePciBus()) | ||
1027 | 3504 | self.assertEqual(HWBus.PCCARD, pccard_device.translatePciBus()) | ||
1028 | 3505 | |||
1029 | 3506 | def test_real_bus_usb_device(self): | ||
1030 | 3507 | """Test of UdevDevice.real_bus for a USB device.""" | ||
1031 | 3508 | usb_device = UdevDevice(None, self.usb_device_data) | ||
1032 | 3509 | self.assertEqual(HWBus.USB, usb_device.real_bus) | ||
1033 | 3510 | |||
1034 | 3511 | def test_real_bus_usb_interface(self): | ||
1035 | 3512 | """Test of UdevDevice.real_bus for a USB interface.""" | ||
1036 | 3513 | parser = SubmissionParser(self.log) | ||
1037 | 3514 | parser.submission_key = 'UdevDevice.real_bus for a not-real device' | ||
1038 | 3515 | usb_interface = UdevDevice(parser, self.usb_storage_usb_interface) | ||
1039 | 3516 | self.assertEqual(None, usb_interface.real_bus) | ||
1040 | 3517 | # UdevDevice.real_bus should only be accessed for real devices, | ||
1041 | 3518 | # which a USB is not. Hence we get a warning. | ||
1042 | 3519 | self.assertWarningMessage( | ||
1043 | 3520 | parser.submission_key, | ||
1044 | 3521 | "Unknown bus 'usb_interface' for device " | ||
1045 | 3522 | "/devices/pci0000:00/0000:00:1d.7/usb1/1-1/1-1:1.0") | ||
1046 | 3523 | |||
1047 | 3524 | def test_real_bus_pci(self): | ||
1048 | 3525 | """Test of UdevDevice.real_bus for PCI devices.""" | ||
1049 | 3526 | devices = self.buildUdevDeviceHierarchy( | ||
1050 | 3527 | self.pci_bridge_pccard_hierarchy_data) | ||
1051 | 3528 | pci_device = devices[1] | ||
1052 | 3529 | pccard_device = devices[2] | ||
1053 | 3530 | self.assertEqual(HWBus.PCI, pci_device.real_bus) | ||
1054 | 3531 | self.assertEqual(HWBus.PCCARD, pccard_device.real_bus) | ||
1055 | 3532 | |||
1056 | 3533 | def test_real_bus_scsi(self): | ||
1057 | 3534 | """Test of UdevDevice.real_bus for a SCSI device.""" | ||
1058 | 3535 | devices = self.buildUdevDeviceHierarchy( | ||
1059 | 3536 | self.scsi_device_hierarchy_data) | ||
1060 | 3537 | scsi_device = devices[-1] | ||
1061 | 3538 | self.assertEqual(HWBus.SCSI, scsi_device.real_bus) | ||
1062 | 3539 | |||
1063 | 3540 | def test_real_bus_system(self): | ||
1064 | 3541 | """Test of UdevDevice.real_bus for a system.""" | ||
1065 | 3542 | root_device = UdevDevice(None, self.root_device) | ||
1066 | 3543 | self.assertEqual(HWBus.SYSTEM, root_device.real_bus) | ||
1067 | 3544 | |||
1068 | 2913 | 3545 | ||
1069 | 2914 | class TestHWDBSubmissionTablePopulation(TestCaseHWDB): | 3546 | class TestHWDBSubmissionTablePopulation(TestCaseHWDB): |
1070 | 2915 | """Tests of the HWDB popoluation with submitted data.""" | 3547 | """Tests of the HWDB popoluation with submitted data.""" |
This branch has several small improvements for the HWDB submission
processing script for submissions with udev data:
- it fixes a bug in the udev test data for USB storage devices: The udev
property DEVTYPE was missing.
This uncovered a (now fixed) bug in BaseDevice. translateScsiBu s()
Up to now, the detection of a USB storage device pretending to be a
SCSI device was based on the value "usb" of the property raw_bus of an
ancestor node of the fake SCSI device, but the real value of
ancestor.raw_bus for udev submissions is "usb_interface". Since this
value is not used in submissions with HAL data, there are no bad
side-effects.
- it defines a new property BaseDevice. is_root_ device, implemented in
the derived classes HALDevice and UdevDevice. There are a few places
in the code, were the root device needs to be treated specially. Up to
now, the decision "is this device the root device" was based on a
comparison of the HAL-specific property "udi".
- it modifies the property BaseDevice.real_bus to properly deal with
udev submissions. If we have a SCSI device, is now detected by
comparing the value self.raw_bus with 'scsi' and 'scsi_device'. Again,
HAL does not use the new value 'scsi_device', so there are no bad side
effects.
- it adds tests for UdevDevice.real_bus and UdevDevice. translatePciBus ()
test: ./bin/test --test= 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: /launchpad/ scripts/ hwdbsubmissions .py /launchpad/ scripts/ tests/test_ hwdb_submission _processing. py
lib/canonical
lib/canonical
== Pyflakes notices ==
lib/canonical/ launchpad/ scripts/ hwdbsubmissions .py
22: redefinition of unused 'etree' from line 20
== Pylint notices ==
lib/canonical/ launchpad/ scripts/ hwdbsubmissions .py cElementTree' (No module
20: [F0401] Unable to import 'xml.etree.
named etree)
The complaint is not related to my changes.