Skip to content

Commit ca37eec

Browse files
committed
Use default values when pnp_id is not supplied
1 parent 313e7cd commit ca37eec

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ repos:
1818
- id: end-of-file-fixer
1919
- id: trailing-whitespace
2020
- repo: https://github.com/pycqa/pylint
21-
rev: v2.17.4
21+
rev: v3.3.0
2222
hooks:
2323
- id: pylint
2424
name: pylint (library code)

adafruit_ble/services/standard/device_info.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class DeviceInfoService(Service):
4545
manufacturer = FixedStringCharacteristic(uuid=StandardUUID(0x2A29))
4646
pnp_id = StructCharacteristic("<BHHH", uuid=StandardUUID(0x2A50))
4747

48-
def __init__(
48+
def __init__( # pylint: disable=too-many-arguments
4949
self,
5050
*,
5151
manufacturer: Optional[str] = None,
@@ -71,6 +71,10 @@ def __init__(
7171
pass
7272
if firmware_revision is None:
7373
firmware_revision = getattr(os.uname(), "version", None)
74+
if pnp_id is None:
75+
# These values are not necessarily valid according to the spec,
76+
# but they work on Android and iOS.
77+
pnp_id = (0x00, 0x0000, 0x0000, 0x0000)
7478
super().__init__(
7579
manufacturer=manufacturer,
7680
software_revision=software_revision,

0 commit comments

Comments
 (0)