mirror of
https://github.com/godotengine/buildroot.git
synced 2026-01-05 14:09:53 +03:00
package/python-hwdata: new package
Provides python interface to database stored in hwdata package. It allows you to get human readable description of USB and PCI devices. https://github.com/xsuchy/python-hwdata Signed-off-by: Julien Olivain <ju.o@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
committed by
Thomas Petazzoni
parent
a2867fec00
commit
7a99e1fa29
40
support/testing/tests/package/sample_python_hwdata.py
Normal file
40
support/testing/tests/package/sample_python_hwdata.py
Normal file
@@ -0,0 +1,40 @@
|
||||
#! /usr/bin/env python3
|
||||
|
||||
from hwdata import PCI, PNP, USB
|
||||
|
||||
# Test PCI IDs
|
||||
pci_vendor_id = '1af4'
|
||||
pci_device_id = '1003'
|
||||
|
||||
pci = PCI()
|
||||
|
||||
pci_vendor = pci.get_vendor(pci_vendor_id)
|
||||
print("PCI Vendor: %s" % pci_vendor)
|
||||
assert (pci_vendor == "Red Hat, Inc.")
|
||||
|
||||
pci_device = pci.get_device(pci_vendor_id, pci_device_id)
|
||||
print("PCI Device: %s" % pci_device)
|
||||
assert (pci_device == "Virtio console")
|
||||
|
||||
# Test USB IDs
|
||||
usb_vendor_id = '1d6b'
|
||||
usb_device_id = '0001'
|
||||
|
||||
usb = USB()
|
||||
|
||||
usb_vendor = usb.get_vendor(usb_vendor_id)
|
||||
print("USB Vendor: %s" % usb_vendor)
|
||||
assert (usb_vendor == "Linux Foundation")
|
||||
|
||||
usb_device = usb.get_device(usb_vendor_id, usb_device_id)
|
||||
print("USB Device: %s" % usb_device)
|
||||
assert (usb_device == "1.1 root hub")
|
||||
|
||||
# Test PNP IDs
|
||||
pnp_id = 'RHT'
|
||||
|
||||
pnp = PNP()
|
||||
|
||||
pnp_vendor = pnp.get_vendor(pnp_id)
|
||||
print("PNP Vendor: %s" % pnp_vendor)
|
||||
assert (pnp_vendor == "Red Hat, Inc.")
|
||||
12
support/testing/tests/package/test_python_hwdata.py
Normal file
12
support/testing/tests/package/test_python_hwdata.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from tests.package.test_python import TestPythonPackageBase
|
||||
|
||||
|
||||
class TestPythonHwdata(TestPythonPackageBase):
|
||||
__test__ = True
|
||||
config = TestPythonPackageBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON3=y
|
||||
BR2_PACKAGE_PYTHON_HWDATA=y
|
||||
"""
|
||||
sample_scripts = ["tests/package/sample_python_hwdata.py"]
|
||||
timeout = 10
|
||||
Reference in New Issue
Block a user