diff options
author | Ryan Pavlik <ryan.pavlik@collabora.com> | 2021-02-10 15:30:51 -0600 |
---|---|---|
committer | Ryan Pavlik <ryan.pavlik@collabora.com> | 2021-02-10 15:30:51 -0600 |
commit | 6a0fcb6854cd9e50833c494314acbf5ef16436b9 (patch) | |
tree | 7b2eadd74d4c0e1c7ac8762ed91c32c3052a1eea | |
parent | 5e0acafd87200874c9bcdff147b93a8a9a1656f6 (diff) | |
parent | 868522becd0d43d3d3a86f622dc139b17f595514 (diff) |
Update upstream source from tag 'upstream/0.4.0'
Update to upstream version '0.4.0'
with Debian dir 5795a6f99fabbc8549065834f5a9d781f87fd28d
-rw-r--r-- | 70-xrhardware.hwdb | 8 | ||||
-rw-r--r-- | 70-xrhardware.rules | 8 | ||||
-rw-r--r-- | CHANGELOG.md | 11 | ||||
-rw-r--r-- | xrhardware/db.py | 3 | ||||
-rw-r--r-- | xrhardware/device.py | 25 |
5 files changed, 52 insertions, 3 deletions
diff --git a/70-xrhardware.hwdb b/70-xrhardware.hwdb index b3ddb2f..725d5b0 100644 --- a/70-xrhardware.hwdb +++ b/70-xrhardware.hwdb @@ -140,6 +140,14 @@ usb:v045ep0659* usb:v04e8p7312* ID_xrhardware=1 +# HP Reverb G1 +usb:v03f0p0c6a* + ID_xrhardware=1 + +# HP Reverb G2 +usb:v03f0p0580* + ID_xrhardware=1 + # Vis3r NxtVR usb:v1209p9d0f* ID_xrhardware=1 diff --git a/70-xrhardware.rules b/70-xrhardware.rules index 791ec7c..feda61e 100644 --- a/70-xrhardware.rules +++ b/70-xrhardware.rules @@ -145,6 +145,14 @@ ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0659", TAG+="uaccess", ENV{ID_xrhard ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="7312", TAG+="uaccess", ENV{ID_xrhardware}="1" +# HP Reverb G1 - USB +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="0c6a", TAG+="uaccess", ENV{ID_xrhardware}="1" + + +# HP Reverb G2 - USB +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="0580", TAG+="uaccess", ENV{ID_xrhardware}="1" + + # Vis3r NxtVR - USB ATTRS{idVendor}=="1209", ATTRS{idProduct}=="9d0f", TAG+="uaccess", ENV{ID_xrhardware}="1" diff --git a/CHANGELOG.md b/CHANGELOG.md index 46edbff..c70d1ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ SPDX-License-Identifier: CC0-1.0 SPDX-FileCopyrightText: 2020 Collabora, Ltd. and the xr-hardware contributors --> +## xr-hardware 0.4.0 (2021-02-10) + +- Additions + - HP Reverb G1 & G2 + ([!12](https://gitlab.freedesktop.org/monado/utilities/xr-hardware/merge_requests/12)) +- Improvements + - Add validators to `vid`, `pid`, and `usb_serial_name` fields directly in the + class, for better error detection. + ([!13](https://gitlab.freedesktop.org/monado/utilities/xr-hardware/merge_requests/13), + [#4](https://gitlab.freedesktop.org/monado/utilities/xr-hardware/issues/4)) + ## xr-hardware 0.3.0 (2020-12-02) Note that the default branch has been renamed to "main" in the repository. diff --git a/xrhardware/db.py b/xrhardware/db.py index 97eb818..fa16699 100644 --- a/xrhardware/db.py +++ b/xrhardware/db.py @@ -70,6 +70,9 @@ def get_devices(): Device("Microsoft HoloLens Sensors", "045e", "0659"), Device("Samsung Odyssey+ sensors", "04e8", "7312"), + Device("HP Reverb G1", "03f0", "0c6a"), + Device("HP Reverb G2", "03f0", "0580"), + # Pretends to be a DK1... # Device("VR-Tek WVR1", "2833", "0001"), diff --git a/xrhardware/device.py b/xrhardware/device.py index 9ded55d..ff009cc 100644 --- a/xrhardware/device.py +++ b/xrhardware/device.py @@ -5,6 +5,25 @@ """XR Hardware device database element type.""" import attr +import re + +_VID_PID_RE = re.compile(r'^[0-9a-f]{4}$') + +_USBSERIALNAME_RE = re.compile(r'^[._0-9a-zA-Z]+$') + + +def _is_four_hexits(_self, _attribute, val): + if not _VID_PID_RE.match(val): + raise ValueError("Must be four hexadecimal characters in lowercase") + + +def _is_suitable_device_name(_self, _attribute, val): + if val is None: + return + if not _USBSERIALNAME_RE.match(val): + raise ValueError( + "Must be a reasonable thing to put in a device node name: " + "a-z, A-Z, numbers, ., _") @attr.s @@ -12,9 +31,9 @@ class Device: """An XR hardware device that we should permit access to.""" description = attr.ib() - vid = attr.ib(default=None) - pid = attr.ib(default=None) - usb_serial_name = attr.ib(default=None) + vid = attr.ib(default=None, validator=_is_four_hexits) + pid = attr.ib(default=None, validator=_is_four_hexits) + usb_serial_name = attr.ib(default=None, validator=_is_suitable_device_name) usb = attr.ib(default=True) bluetooth = attr.ib(default=False) extra_properties = attr.ib(default=None) |