Virtual serial port in usermode?
- From: Philip Pemberton <philpem@xxxxxxxxx>
- Date: Sat, 26 Jan 2008 17:25:46 -0800 (PST)
Hi,
I'm trying to develop a simulator for a smartcard processor I'm
currently writing some code for. What I want to do is take a CPU core,
an emulated version of the UART and crypto coprocessor, and then tack
those onto a software model of a "Phoenix" (SmartMouse) RS232
smartcard interface (which is about as simple as you can go for
ISO7816 -- a MAX232 and a 74LS04 inverter). Basically, you wiggle RTS
to reset the card, and send data over RXD/TXD. Nice and simple, and
OpenCT already has a known-working driver (<http://www.opensc-
project.org/openct/wiki/smph>). The reason I'm going to all this
trouble is because the cards are one-time-programmable, cost on the
order of $40 each, and aren't exactly easy to get in the first place.
Naturally, I'd like to ruin as few of them as possible.
The CPU core isn't the problem -- that's basically done already (in
the form of a low-level debugger). What I want to do is write a user-
mode application that creates a virtual serial port, then listens for
commands/data and passes them onto the CPU core via the UART emulation
layer.
Now, I've seen "softmodem" drivers for Linux that run as daemons,
process AT commands and such, and most of the ones I've looked at use
pseudo-ttys to handle the 'virtual COM port' side of things. What I
haven't been able to find out is if there's a way I can tell the OS to
fire off a callback when RTS changes state (a reset), so I can force
the emulated CPU to do a full reset.
Based on the "Linux Serial Programming HOWTO", it looks like ioctl()
calls are used to change the state of the serial handshaking lines --
is it even possible to trap these without writing a kernel module?
Thanks,
Phil.
.
- Follow-Ups:
- Re: Virtual serial port in usermode?
- From: Grant Edwards
- Re: Virtual serial port in usermode?
- Prev by Date: Re: sigaction and waitpid causes "interrupted system call" when calling fgets()
- Next by Date: Re: Virtual serial port in usermode?
- Previous by thread: sigaction and waitpid causes "interrupted system call" when calling fgets()
- Next by thread: Re: Virtual serial port in usermode?
- Index(es):