Commit 742f02c7 authored by Mart Lubbers's avatar Mart Lubbers

rename platform, better device selection

parent 6f7d5443
Pipeline #15485 passed with stage
in 3 minutes and 1 second
definition module Platform
definition module TTYPlatform
getDevices :: !*World -> *([String], !*World)
implementation module Platform
implementation module TTYPlatform
import Data.Error
import StdMisc, StdOverloaded, StdString
import StdEnv
import System.Directory
import Data.Func
import Text
getDevices :: !*World -> *([String], !*World)
getDevices w = case readDirectory "/dev" w of
(Error (errcode, errmsg), w) = abort errmsg
(Ok entries, w) = (entries, w)
(Ok entries, w) = (sortBy (on (>) known) (filter isaTTYdevice entries), w)
isaTTYdevice "." = False
isaTTYdevice ".." = False
isaTTYdevice t = startsWith "tty" t
known t
| startsWith "ttyACM" t = 1
| startsWith "ttyUSB" t = 1
| startsWith "ttyS" t = 1
= 0
......@@ -5,7 +5,7 @@ import StdEnv
import System.OS
import Text
import Platform
import TTYPlatform
import code from "ctty.o"
......
definition module Platform
definition module TTYPlatform
getDevices :: !*World -> *([String], !*World)
implementation module Platform
implementation module TTYPlatform
import code from library "CleanSerial_library"
import code from library "CleanSerial2_library"
......
......@@ -15,6 +15,5 @@ all: listDevices
cpm project $(basename $@) create
cpm project $@ target iTasks
cpm project $@ set -h 2000m -s 20m -dynamics
cpm project $@ root ..
cpm project $@ path add "$$PWD/../$(DETECTED_OS)"
cpm project $@ path add "$$PWD/.."
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment