Skip to content

Commit affd343

Browse files
committed
Extra readme section for troubleshooting
1 parent 0eb052f commit affd343

File tree

1 file changed

+27
-23
lines changed

1 file changed

+27
-23
lines changed

README.md

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ $ ble-serial -d 20:91:48:4c:4c:54 -r 0000ffe1-0000-1000-8000-00805f9b34fb --perm
268268
Here `-r` is enough for `ro` = read only.
269269
This works also the other way around with `wo` = write only.
270270

271-
### Logging
271+
### Log to file
272272
There is an option to log all traffic on the link to a text file:
273273
```
274274
logging options:
@@ -287,28 +287,6 @@ $ cat demo.txt
287287
```
288288
Per default it is transformed to hex bytes, use `-b`/`--binary` to log raw data, useful if your input is already ASCII etc.
289289

290-
You can use `-v` to increase the log verbosity to DEBUG:
291-
```console
292-
18:31:25.136 | DEBUG | ble_interface.py: Received notify from 17: bytearray(b'\xb0\xb0\xb0\xb0\xb0\xb0;\xb0\xb0\xb0\xba\xb0\r\x8a')
293-
18:31:25.136 | DEBUG | linux_pty.py: Write: bytearray(b'\xb0\xb0\xb0\xb0\xb0\xb0;\xb0\xb0\xb0\xba\xb0\r\x8a')
294-
295-
18:31:25.373 | DEBUG | linux_pty.py: Read: b'hello world'
296-
18:31:25.373 | DEBUG | ble_interface.py: Sending b'hello world'
297-
```
298-
This will log all traffic going through. Note that everything shows up two times, because it goes through the ble module and then into the serial port and vice versa.
299-
It also helps with figuring out how characteristics are selected:
300-
```console
301-
14:32:47.589 | DEBUG | ble_interface.py: No write uuid specified, trying builtin list
302-
14:32:47.589 | DEBUG | ble_interface.py: Characteristic candidates for write:
303-
0000ffe1-0000-1000-8000-00805f9b34fb (Handle: 17): Vendor specific ['read', 'write-without-response', 'notify']
304-
14:32:47.589 | INFO | ble_interface.py: Found write characteristic 0000ffe1-0000-1000-8000-00805f9b34fb (H. 17)
305-
14:32:47.589 | DEBUG | ble_interface.py: No notify uuid specified, trying builtin list
306-
14:32:47.589 | DEBUG | ble_interface.py: Characteristic candidates for notify:
307-
0000ffe1-0000-1000-8000-00805f9b34fb (Handle: 17): Vendor specific ['read', 'write-without-response', 'notify']
308-
14:32:47.589 | INFO | ble_interface.py: Found notify characteristic 0000ffe1-0000-1000-8000-00805f9b34fb (H. 17)
309-
```
310-
Always try the verbose option if something is not working properly.
311-
312290
## Advanced Usage
313291
### TCP socket server
314292
Instead of the serial port emulation there is a also builtin raw tcp server since version 2.7:
@@ -417,6 +395,32 @@ On Linux you can also use the included systemd (user) service to auto start this
417395
ble-serial is primarily designed for command line usage. Nonetheless it is possible to import modules of it into another python application. See the
418396
[`examples/`](https://github.com/Jakeler/ble-serial/tree/master/examples) dir for how to use the ble parts directly.
419397

398+
## Troubleshooting
399+
First you can use `-v` to increase the log verbosity to DEBUG:
400+
```console
401+
18:31:25.136 | DEBUG | ble_interface.py: Received notify from 17: bytearray(b'\xb0\xb0\xb0\xb0\xb0\xb0;\xb0\xb0\xb0\xba\xb0\r\x8a')
402+
18:31:25.136 | DEBUG | linux_pty.py: Write: bytearray(b'\xb0\xb0\xb0\xb0\xb0\xb0;\xb0\xb0\xb0\xba\xb0\r\x8a')
403+
404+
18:31:25.373 | DEBUG | linux_pty.py: Read: b'hello world'
405+
18:31:25.373 | DEBUG | ble_interface.py: Sending b'hello world'
406+
```
407+
This will log all traffic going through. Note that everything shows up two times, because it goes through the ble module and then into the serial port and vice versa.
408+
It also helps with figuring out how characteristics are selected:
409+
```console
410+
14:32:47.589 | DEBUG | ble_interface.py: No write uuid specified, trying builtin list
411+
14:32:47.589 | DEBUG | ble_interface.py: Characteristic candidates for write:
412+
0000ffe1-0000-1000-8000-00805f9b34fb (Handle: 17): Vendor specific ['read', 'write-without-response', 'notify']
413+
14:32:47.589 | INFO | ble_interface.py: Found write characteristic 0000ffe1-0000-1000-8000-00805f9b34fb (H. 17)
414+
14:32:47.589 | DEBUG | ble_interface.py: No notify uuid specified, trying builtin list
415+
14:32:47.589 | DEBUG | ble_interface.py: Characteristic candidates for notify:
416+
0000ffe1-0000-1000-8000-00805f9b34fb (Handle: 17): Vendor specific ['read', 'write-without-response', 'notify']
417+
14:32:47.589 | INFO | ble_interface.py: Found notify characteristic 0000ffe1-0000-1000-8000-00805f9b34fb (H. 17)
418+
```
419+
Always try the verbose option if something is not working properly.
420+
421+
If this is not enough use the double verbose `-vv` flag. It activates debug logging also for the underlying [bleak](https://github.com/hbldh/bleak) module and shows interactions with the bluetooth stack more detailed.
422+
Check out the [issue tracker](https://github.com/hbldh/bleak/issues) there too, it is often helpful for problems not directly caused by ble-serial.
423+
420424
## Known limitations
421425
* Chromium 73+ based applications, including NW.js/electron desktop apps, for example current Betaflight/INAV Configurator: Connection to the virtual serial port (pty) fails. This is because of explicit whitelisting in chromium.
422426

0 commit comments

Comments
 (0)