Skip to content

EIRData parsing error: "0 is not a valid ADType" #13

@martin-flaska

Description

@martin-flaska

Sporadically I get this unhandled exception in EIRData.decode / Packet.decode methods.

Apr 29 12:55:40 intercom-00056 gas-daemon[31223]: An exception occurred asynchronously: {'message': 'Exception in callback Mgmt.reader()', 'exception': ValueError('0 is not a valid ADType'), 'handle': <Handle Mgmt.reader()>}
                                                  Traceback (most recent call last):
                                                    File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
                                                      self._context.run(self._callback, *self._args)
                                                    File "/usr/lib/python3.10/site-packages/btsocket/btmgmt_callback.py", line 46, in reader
                                                      pkt = btmgmt_protocol.reader(data)
                                                    File "/usr/lib/python3.10/site-packages/btsocket/btmgmt_protocol.py", line 1055, in reader
                                                      cmd_params = event_frame.decode(evt_params)
                                                    File "/usr/lib/python3.10/site-packages/btsocket/btmgmt_protocol.py", line 238, in decode
                                                      data_type.decode(pkt[pointer:pointer + param.width])
                                                    File "/usr/lib/python3.10/site-packages/btsocket/btmgmt_protocol.py", line 197, in decode
                                                      self.value[ADType(data_type)] = data[data_start:data_end]
                                                    File "/usr/lib/python3.10/enum.py", line 385, in __call__
                                                      return cls.__new__(cls, value)
                                                    File "/usr/lib/python3.10/enum.py", line 710, in __new__
                                                      raise ve_exc
                                                  ValueError: 0 is not a valid ADType

I tried to get more logs and data on which this happen - see my commit

Jun 18 14:04:08 intercom-00057 gas_daemon[832]: Packet.decode: failed to decode eir_data as EIRData. Offset: 14, width: 65535, pkt: 6d 46 2d 13 b1 b0 01 9c 00 00 00 00 1f 00 02 01 06 1b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 f0 ff. Error: EIRData.decode: Invalid ADType, data len: 31, data: 1b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 f0 ff

I was not able to parse data before 1b 00 ... f0 ff problematic advertisement chunk. There seems to be one potentially valid chunk 02 01 06 (IncompleteUUID16ServiceList ?). But I observed this happens on specific device locations, so might be related to some unsupported BT device.

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions