max wrote:Hey Jay Jay,
that's an interesting topic. As you said, using the filesystem has advantages as it's very generic. Though I think that is somehow "mis-used" for that, I think a communication via a central server & pipes would be more suitable.
Is this not what the file system provides? named pipes to a backend controller? What I'm interested in is the removal of pipes, which ultimately means pure syscalls returning populated structures - but is there an alternative to this too?
max wrote:One of my ideas how to solve it is the following. First, a device - say, a printer - is installed to the system. The driver for that device establishes a connection to a central "device management server" (the DMS) that keeps track of all installed devices. The DMS knows a list of generic functionalities; for example a printing functionality, an audio input functionality etc.. The device driver tells the DMS about which of these functionalities are supported.
A program can now ask the DMS which devices are available for generic-function-x, and the DMS supplies the information necessary to communicate with that devices driver. The driver must then react to the generic commands (for example via a pipe with a defined protocol) and make the device do the thing.
This sounds like an Entity-Component-System architecture, which would make for interesting design. Treating modules/drivers as an entity with attached components, and each component is driven by a centralised system dedicated to the features of the component. So you could have a UART component, which is derived into the specific UART types, and is driven by the UART system, with data being provided by another component, or to another component (for example USB-to-TTL devices). Drivers could chain or combine components to match the features of the device.
max wrote:The information in the management server can then also be used to for example display in a user device management center which devices are installed and what is available. If a device has a non-generic functionality, the driver can still register it at the DMS; a program must then know how to communicate with the device driver.
The advantages of this approach are, that for common devices the generic functionalities (which should be versioned, to allow steady improvements) are easy-to-use for programs and should be well implementable for the drivers. Also, the management server could be simply exchanged as it runs in userspace.
But, ultimately, this system would still depend on a pseudo file system due to the requirement of pipes - to access the pipes, you open them by name on the file system.
This does remind me of the way some Windows devices present in user space - COM1, COM2 etc. can be opened by name, but do not technically exist within the file system (but still act as files nonetheless).