Introduce constant for Logitech vendor ID
The Vendor ID for Logitech is 0x46D = 1133.
This commit is contained in:
parent
d67466298b
commit
7f5e156fa1
|
@ -38,6 +38,7 @@ from . import exceptions
|
|||
from . import hidpp10_constants
|
||||
from . import hidpp20
|
||||
from . import hidpp20_constants
|
||||
from .common import LOGITECH_VENDOR_ID
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -59,7 +60,7 @@ class HIDPPNotification:
|
|||
|
||||
def _usb_device(product_id: int, usb_interface: int) -> dict[str, Any]:
|
||||
return {
|
||||
"vendor_id": 1133,
|
||||
"vendor_id": LOGITECH_VENDOR_ID,
|
||||
"product_id": product_id,
|
||||
"bus_id": 3,
|
||||
"usb_interface": usb_interface,
|
||||
|
@ -68,7 +69,7 @@ def _usb_device(product_id: int, usb_interface: int) -> dict[str, Any]:
|
|||
|
||||
|
||||
def _bluetooth_device(product_id: int) -> dict[str, Any]:
|
||||
return {"vendor_id": 1133, "product_id": product_id, "bus_id": 5, "isDevice": True}
|
||||
return {"vendor_id": LOGITECH_VENDOR_ID, "product_id": product_id, "bus_id": 5, "isDevice": True}
|
||||
|
||||
|
||||
KNOWN_DEVICE_IDS = []
|
||||
|
@ -84,7 +85,7 @@ for _ignore, d in descriptors.DEVICES.items():
|
|||
def other_device_check(bus_id: int, vendor_id: int, product_id: int):
|
||||
"""Check whether product is a Logitech USB-connected or Bluetooth device based on bus, vendor, and product IDs
|
||||
This allows Solaar to support receiverless HID++ 2.0 devices that it knows nothing about"""
|
||||
if vendor_id != 0x46D: # Logitech
|
||||
if vendor_id != LOGITECH_VENDOR_ID:
|
||||
return
|
||||
if bus_id == 0x3: # USB
|
||||
if product_id >= 0xC07D and product_id <= 0xC094 or product_id >= 0xC32B and product_id <= 0xC344:
|
||||
|
@ -143,7 +144,7 @@ def filter_receivers(bus_id, vendor_id, product_id, hidpp_short=False, hidpp_lon
|
|||
for record in base_usb.ALL: # known receivers
|
||||
if match(record, bus_id, vendor_id, product_id):
|
||||
return record
|
||||
if vendor_id == 0x046D and 0xC500 <= product_id <= 0xC5FF: # unknown receiver
|
||||
if vendor_id == LOGITECH_VENDOR_ID and 0xC500 <= product_id <= 0xC5FF: # unknown receiver
|
||||
return {"vendor_id": vendor_id, "product_id": product_id, "bus_id": bus_id, "isDevice": False}
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
from solaar.i18n import _
|
||||
|
||||
from logitech_receiver.common import LOGITECH_VENDOR_ID
|
||||
|
||||
# max_devices is only used for receivers that do not support reading from Registers.RECEIVER_INFO offset 0x03, default
|
||||
# to 1.
|
||||
# may_unpair is only used for receivers that do not support reading from Registers.RECEIVER_INFO offset 0x03,
|
||||
|
@ -33,13 +35,11 @@ from solaar.i18n import _
|
|||
# unpair is for receivers that do support reading from Registers.RECEIVER_INFO offset 0x03, no default.
|
||||
## should this last be changed so that may_unpair is used for all receivers? writing to Registers.RECEIVER_PAIRING
|
||||
## doesn't seem right
|
||||
# re_pairs determines whether a receiver pairs by replacing existing pairings, default to False
|
||||
## currently only one receiver is so marked - should there be more?
|
||||
|
||||
|
||||
def _bolt_receiver(product_id):
|
||||
return {
|
||||
"vendor_id": 1133,
|
||||
"vendor_id": LOGITECH_VENDOR_ID,
|
||||
"product_id": product_id,
|
||||
"usb_interface": 2,
|
||||
"name": _("Bolt Receiver"),
|
||||
|
@ -51,7 +51,7 @@ def _bolt_receiver(product_id):
|
|||
|
||||
def _unifying_receiver(product_id):
|
||||
return {
|
||||
"vendor_id": 1133,
|
||||
"vendor_id": LOGITECH_VENDOR_ID,
|
||||
"product_id": product_id,
|
||||
"usb_interface": 2,
|
||||
"name": _("Unifying Receiver"),
|
||||
|
@ -62,7 +62,7 @@ def _unifying_receiver(product_id):
|
|||
|
||||
def _nano_receiver(product_id):
|
||||
return {
|
||||
"vendor_id": 1133,
|
||||
"vendor_id": LOGITECH_VENDOR_ID,
|
||||
"product_id": product_id,
|
||||
"usb_interface": 1,
|
||||
"name": _("Nano Receiver"),
|
||||
|
@ -74,7 +74,7 @@ def _nano_receiver(product_id):
|
|||
|
||||
def _nano_receiver_no_unpair(product_id):
|
||||
return {
|
||||
"vendor_id": 1133,
|
||||
"vendor_id": LOGITECH_VENDOR_ID,
|
||||
"product_id": product_id,
|
||||
"usb_interface": 1,
|
||||
"name": _("Nano Receiver"),
|
||||
|
@ -87,7 +87,7 @@ def _nano_receiver_no_unpair(product_id):
|
|||
|
||||
def _nano_receiver_max2(product_id):
|
||||
return {
|
||||
"vendor_id": 1133,
|
||||
"vendor_id": LOGITECH_VENDOR_ID,
|
||||
"product_id": product_id,
|
||||
"usb_interface": 1,
|
||||
"name": _("Nano Receiver"),
|
||||
|
@ -100,7 +100,7 @@ def _nano_receiver_max2(product_id):
|
|||
|
||||
def _nano_receiver_maxn(product_id, max):
|
||||
return {
|
||||
"vendor_id": 1133,
|
||||
"vendor_id": LOGITECH_VENDOR_ID,
|
||||
"product_id": product_id,
|
||||
"usb_interface": 1,
|
||||
"name": _("Nano Receiver"),
|
||||
|
@ -124,7 +124,7 @@ def _lenovo_receiver(product_id):
|
|||
|
||||
def _lightspeed_receiver(product_id):
|
||||
return {
|
||||
"vendor_id": 1133,
|
||||
"vendor_id": LOGITECH_VENDOR_ID,
|
||||
"product_id": product_id,
|
||||
"usb_interface": 2,
|
||||
"receiver_kind": "lightspeed",
|
||||
|
@ -135,7 +135,7 @@ def _lightspeed_receiver(product_id):
|
|||
|
||||
def _ex100_receiver(product_id):
|
||||
return {
|
||||
"vendor_id": 1133,
|
||||
"vendor_id": LOGITECH_VENDOR_ID,
|
||||
"product_id": product_id,
|
||||
"usb_interface": 1,
|
||||
"name": _("EX100 Receiver 27 Mhz"),
|
||||
|
|
|
@ -27,6 +27,8 @@ import yaml
|
|||
|
||||
from solaar.i18n import _
|
||||
|
||||
LOGITECH_VENDOR_ID = 0x046D
|
||||
|
||||
|
||||
def crc16(data: bytes):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue