Skip to content

Alternative for device paths #14

@thejpster

Description

@thejpster

Other Systems

MS-DOS has device paths like COM1, CON, LPT1. These files work in any current directory. MS-DOS also has drive letters, giving paths like C:\DOS\HIMEM.SYS.

UNIX has device paths like /dev/ttyS1, /dev/tty, /dev/lp0. These all have absolute paths within the common POSIX file hierarchy, and POSIX has no drive letters - filesystems are mounted into the hierarchy somewhere (e.g. /home/jonathan/file.txt).

Neotron Currently

The book currently proposes drive names, like work:/documents/file.txt. It also proposes to use the drive names to indicate devices, such as com1$baud=115200:.

On reflection, these complicated drive names are somewhat undiscoverable. You could have a DRIVES command which will list the known drives, but you cannot exhaustively list all the properties available for each of them.

Some alternatives

Option 1: A MODE command.

Go back to relative MS-DOS style device paths, or place all the devices inside some DEV: drive, such as DEV:lp0 and DEV:com1. Parameters are set for any given device through the use of a MODE command, such as MODE DEV:com1 baud=115200 parity=N stop=1. Now the devices are discoverable (DIR DEV:) but the properties are only discoverable by running the command MODE /?. Additional devices will require an update to the MODE command to support their properties.

Option 2: A sysfs style tree

Adopt the Linux approach of having properties represented by files within a virtual tree. For example, DEV:com1/ is a folder, and within it DEV:com1/baud is a file. You can read the file and get 115200\n, or you can write a string to that file to change the baud rate. The device itself would be DEV:com1/device. Now the devices are discoverable (DIR DEV:) and also the properties are discoverable (DIR DEV:com1/).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions