As the title asks, how can I I map file IO from a file to an existing device?
I am using a higher level programming language on one of these common SoC single board computers running Linux. This language has a library to access the serial port to send TX and receive RX data. The library accesses /dev/ttyAMA0 to do reading and writing, but unfortunately when you create the Serial object it does so by opening /dev/ttyAMA0 using exclusive access denying other processes or even other instances of the Serial object from using /dev/ttyAMA0.
In my case I wanted to write two separate programs. One program that write to the serial port TX, and another program to read from the serial port RX, but this library won't allow it since its opens /dev/ttyAMA0 using exclusive access. I am thinking with Linux it should be possible to create a second or even a third file which would act as pseudo terminal or something and take any reads or writes and just map all IO access to /dev/ttyAMA0.
So my question is, how can I create a file (or a pseudo tty) on Linux that maps all reads and writes to a device like /dev/ttyAMA0?