1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-08-06 22:32:54 +02:00

add cable_pairing field to fix #662

This commit is contained in:
Kelly Brazil
2025-08-01 07:41:45 -07:00
parent 5f75df2e4b
commit a77298e560
2 changed files with 7 additions and 1 deletions

View File

@ -2,6 +2,7 @@ jc changelog
20250724 v1.25.6
- Add `x509-crl` file parser to support Certificate Revocation List PEM and DER files
- Fix `bluetoothctl` command parser to support output with the `cable_pairing` attribute
- Fix `nmcli` command parser to support blank `team.config` JSON value and `team-port.config` JSON value
- Fix `top` command parsers to correct memory size field parsing. Several new unit
and byte conversion fields have been added

View File

@ -64,6 +64,7 @@ a controller and a device but there might be fields corresponding to one entity.
"blocked": string,
"connected": string,
"legacy_pairing": string,
"cable_pairing": string,
"rssi": int,
"txpower": int,
"uuids": array,
@ -112,7 +113,7 @@ import jc.utils
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.4'
version = '1.5'
description = '`bluetoothctl` command parser'
author = 'Jake Ob'
author_email = 'iakopap at gmail.com'
@ -302,6 +303,7 @@ _device_line_pattern = (
+ r"|\s*TxPower:\s*(?P<txpower>.+)"
+ r"|\s*Battery\sPercentage:\s*0[xX][0-9a-fA-F]*\s*\((?P<battery_percentage>[0-9]+)\)"
+ r"|\s*UUID:\s*(?P<uuid>.+))"
+ r"|\s*CablePairing:\s*(?P<cable_pairing>.+)"
)
@ -335,6 +337,7 @@ def _parse_device(next_lines: List[str], quiet: bool) -> Optional[Device]:
"blocked": '',
"connected": '',
"legacy_pairing": '',
"cable_pairing": '',
"rssi": 0,
"txpower": 0,
"uuids": [],
@ -383,6 +386,8 @@ def _parse_device(next_lines: List[str], quiet: bool) -> Optional[Device]:
device["connected"] = matches["connected"]
elif matches["legacy_pairing"]:
device["legacy_pairing"] = matches["legacy_pairing"]
elif matches["cable_pairing"]:
device["cable_pairing"] = matches["cable_pairing"]
elif matches["rssi"]:
rssi = matches["rssi"]
try: