adafruit / adafruit/Adafruit_BLESniffer_Python

serial.serialutil.SerialException: Attempting to use a port that is not open

Open
#7 25 comments 4 reactions 0 assignees View on GitHub
Dominant language
C
Stars
106
Forks
52
PR merge metrics
No merged PRs in 30d

Description

Trying to use sniffer.py on macOS Sierra (10.12.1) is giving errors:
```
$ sudo python sniffer.py /dev/tty.usbserial-DJ00IO3W
Password:
Logging data to logs/capture.pcap
Connecting to sniffer on /dev/tty.usbserial-DJ00IO3W
Scanning for BLE devices (5s) ...
Traceback (most recent call last):
File "sniffer.py", line 156, in
devlist = scanForDevices()
File "sniffer.py", line 50, in scanForDevices
mySniffer.scan()
File "/Users/itemir/Temp/Adafruit_BLESniffer_Python/SnifferAPI/Sniffer.py", line 62, in scan
self._startScanning()
File "/Users/itemir/Temp/Adafruit_BLESniffer_Python/SnifferAPI/SnifferCollector.py", line 206, in _startScanning
self._packetReader.sendScan()
File "/Users/itemir/Temp/Adafruit_BLESniffer_Python/SnifferAPI/Packet.py", line 186, in sendScan
self.sendPacket(REQ_SCAN_CONT, [], timeout)
File "/Users/itemir/Temp/Adafruit_BLESniffer_Python/SnifferAPI/Packet.py", line 183, in sendPacket
self.uart.writeList(packetString, timeout)
File "/Users/itemir/Temp/Adafruit_BLESniffer_Python/SnifferAPI/UART.py", line 73, in writeList
nBytes = self.ser.write(array)
File "/Library/Python/2.7/site-packages/serial/serialposix.py", line 497, in write
raise portNotOpenError
serial.serialutil.SerialException: Attempting to use a port that is not open
```
[ble-sniffer-osx](http://sourceforge.net/projects/nrfblesnifferosx/) from Roland King works, so it is not an OS issue nor a hardware issue.

It also looks like there have been others who ran into this issue. See the following thread: https://forums.adafruit.com/viewtopic.php?f=22&t=82839&sid=643613138ca6829f5444dd61c1cabc7d&start=15 (Workaround mentioned there, to install 2.3 FTDI driver, does also not work).

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the command on macOS, then trace the failing path from sniffer.py through SnifferAPI/Sniffer.py, SnifferCollector.py, Packet.py, and UART.py. Check the serial-port lifecycle around the write in UART.py and compare the behavior with the referenced ble-sniffer-osx workaround; done means scanning no longer raises the port-not-open exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, python
Domain
cli, embedded-iot, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.