1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-08-10 22:41:51 +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 20250724 v1.25.6
- Add `x509-crl` file parser to support Certificate Revocation List PEM and DER files - 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 `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 - Fix `top` command parsers to correct memory size field parsing. Several new unit
and byte conversion fields have been added 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, "blocked": string,
"connected": string, "connected": string,
"legacy_pairing": string, "legacy_pairing": string,
"cable_pairing": string,
"rssi": int, "rssi": int,
"txpower": int, "txpower": int,
"uuids": array, "uuids": array,
@@ -112,7 +113,7 @@ import jc.utils
class info(): class info():
"""Provides parser metadata (version, author, etc.)""" """Provides parser metadata (version, author, etc.)"""
version = '1.4' version = '1.5'
description = '`bluetoothctl` command parser' description = '`bluetoothctl` command parser'
author = 'Jake Ob' author = 'Jake Ob'
author_email = 'iakopap at gmail.com' author_email = 'iakopap at gmail.com'
@@ -302,6 +303,7 @@ _device_line_pattern = (
+ r"|\s*TxPower:\s*(?P<txpower>.+)" + 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*Battery\sPercentage:\s*0[xX][0-9a-fA-F]*\s*\((?P<battery_percentage>[0-9]+)\)"
+ r"|\s*UUID:\s*(?P<uuid>.+))" + 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": '', "blocked": '',
"connected": '', "connected": '',
"legacy_pairing": '', "legacy_pairing": '',
"cable_pairing": '',
"rssi": 0, "rssi": 0,
"txpower": 0, "txpower": 0,
"uuids": [], "uuids": [],
@@ -383,6 +386,8 @@ def _parse_device(next_lines: List[str], quiet: bool) -> Optional[Device]:
device["connected"] = matches["connected"] device["connected"] = matches["connected"]
elif matches["legacy_pairing"]: elif matches["legacy_pairing"]:
device["legacy_pairing"] = matches["legacy_pairing"] device["legacy_pairing"] = matches["legacy_pairing"]
elif matches["cable_pairing"]:
device["cable_pairing"] = matches["cable_pairing"]
elif matches["rssi"]: elif matches["rssi"]:
rssi = matches["rssi"] rssi = matches["rssi"]
try: try: