mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 21:30:08 +02:00
30 lines
1.2 KiB
Diff
30 lines
1.2 KiB
Diff
From 95e393b4877327ff20b0a0e7411ea37f181ab6e9 Mon Sep 17 00:00:00 2001
|
|
From: OscarL <oscar.lesta@gmail.com>
|
|
Date: Thu, 25 Aug 2022 11:32:14 +0000
|
|
Subject: [PATCH] Add detection for Haiku's serial ports
|
|
|
|
Now that PySerial works OK (without patches. relying on serialposix.py) on the nightly versions of Haiku (see https://haiku-os.org), make sure its ports gets detected properly.
|
|
---
|
|
serial/tools/list_ports_posix.py | 8 ++++++++
|
|
1 file changed, 8 insertions(+)
|
|
|
|
diff --git a/serial/tools/list_ports_posix.py b/serial/tools/list_ports_posix.py
|
|
index b1157546..888f89f9 100644
|
|
--- a/serial/tools/list_ports_posix.py
|
|
+++ b/serial/tools/list_ports_posix.py
|
|
@@ -96,6 +96,14 @@ def comports(include_links=False):
|
|
devices.update(list_ports_common.list_links(devices))
|
|
return [list_ports_common.ListPortInfo(d) for d in devices]
|
|
|
|
+elif plat[:5] == 'haiku': # Haiku
|
|
+ def comports(include_links=False):
|
|
+ """scan for available ports. return a list of device names."""
|
|
+ devices = set(glob.glob('/dev/ports/*'))
|
|
+ if include_links:
|
|
+ devices.update(list_ports_common.list_links(devices))
|
|
+ return [list_ports_common.ListPortInfo(d) for d in devices]
|
|
+
|
|
else:
|
|
# platform detection has failed...
|
|
import serial
|