Whole file
kellyjonbrazil/jc
The author described this change as “Fix broken controller regexp scheme in the bluetoothctl parser (#599)”. It counts as a record because the check below fails on the code as it stood at 78150ded7 and passes on c5e0642b0, with nothing else changed between the two runs.
Projectkellyjonbrazil/jc
Fix saved2024-10-18
Sharing licenceMIT · LICENSE.md
Change size+14 −2
What the code was meant to do, written into the code itself as a save note
Fix broken controller regexp scheme in the bluetoothctl parser (#599)
The change
| 28 | 28 | Controller: | |
| 29 | 29 | [ | |
| 30 | 30 | { | |
| 31 | + | "manufacturer": string, | |
| 32 | + | "version": string, | |
| 31 | 33 | "name": string, | |
| 32 | 34 | "is_default": boolean, | |
| 33 | 35 | "is_public": boolean, | |
| ⋯ | |||
| 127 | 129 | Controller = TypedDict( | |
| 128 | 130 | "Controller", | |
| 129 | 131 | { | |
| 132 | + | "manufacturer": str, | |
| 133 | + | "version": str, | |
| 130 | 134 | "name": str, | |
| 131 | 135 | "is_default": bool, | |
| 132 | 136 | "is_public": bool, | |
| ⋯ | |||
| 175 | 179 | _controller_head_pattern = r"Controller (?P<address>([0-9A-F]{2}:){5}[0-9A-F]{2}) (?P<name>.+)" | |
| 176 | 180 | ||
| 177 | 181 | _controller_line_pattern = ( | |
| 178 | - | r"(\s*Name:\s*(?P<name>.+)" | |
| 182 | + | r"(\s*Manufacturer:\s*(?P<manufacturer>.+)" | |
| 183 | + | + r"|\s*Version:\s*(?P<version>.+)" | |
| 184 | + | + r"|\s*Name:\s*(?P<name>.+)" | |
| 179 | 185 | + r"|\s*Alias:\s*(?P<alias>.+)" | |
| 180 | 186 | + r"|\s*Class:\s*(?P<class>.+)" | |
| 181 | 187 | + r"|\s*Powered:\s*(?P<powered>.+)" | |
| ⋯ | |||
| 203 | 209 | return None | |
| 204 | 210 | ||
| 205 | 211 | controller: Controller = { | |
| 212 | + | "manufacturer": '', | |
| 213 | + | "version": '', | |
| 206 | 214 | "name": '', | |
| 207 | 215 | "is_default": False, | |
| 208 | 216 | "is_public": False, | |
| ⋯ | |||
| 241 | 249 | ||
| 242 | 250 | matches = result.groupdict() | |
| 243 | 251 | ||
| 244 | - | if matches["name"]: | |
| 252 | + | if matches["manufacturer"]: | |
| 253 | + | controller["manufacturer"] = matches["manufacturer"] | |
| 254 | + | elif matches["version"]: | |
| 255 | + | controller["version"] = matches["version"] | |
| 256 | + | elif matches["name"]: | |
| 245 | 257 | controller["name"] = matches["name"] | |
| 246 | 258 | elif matches["alias"]: | |
| 247 | 259 | controller["alias"] = matches["alias"] | |
The check that tells the two apart
fail→pass·tests/test_bluetoothctl.py::BluetoothctlTests::test_bluetoothctl_controller_with_manufacturer
Check file tests/test_bluetoothctl.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it78150ded70d1068fc0f5a138e8704c57df7c97f9
Broken version dated2024-10-17
Modulejc.parsers.bluetoothctl
Units changed_parse_controller
Fingerprint036dfc0fa9bb5924
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in kellyjonbrazil/jc
- 2026-03-25parse
- 2026-03-25_process
- 2025-04-02Fix broken controller parser schema to include power state prop (#652)
- 2025-03-31parse
- 2025-03-31fix time parser for missing centiseconds
- 2024-09-07fix uptime for "user" instead of "users"