Skip to content

Commit 2121aa0

Browse files
authored
Merge pull request #11 from michieldwitte/patch-1
Add windows compatibility to list_devices
2 parents b472b78 + 843e92b commit 2121aa0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/ppk2_api/ppk2_api.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import serial
99
import struct
1010
import logging
11-
11+
import os
1212
import queue
1313
import multiprocessing
1414

@@ -210,7 +210,10 @@ def _handle_raw_data(self, adc_value):
210210
def list_devices():
211211
import serial.tools.list_ports
212212
ports = serial.tools.list_ports.comports()
213-
devices = [port.device for port in ports if port.product == 'PPK2']
213+
if os.name == 'nt':
214+
devices = [port.device for port in ports if port.description.startswith("nRF Connect USB CDC ACM")]
215+
else:
216+
devices = [port.device for port in ports if port.product == 'PPK2']
214217
return devices
215218

216219
def get_data(self):

0 commit comments

Comments
 (0)