Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Spoof /dev/ttyS0

by grinder (Bishop)
on Sep 24, 2008 at 14:05 UTC ( #713433=note: print w/replies, xml ) Need Help??

in reply to Spoof /dev/ttyS0

Point of linguistic order: you don't want to spoof /dev/ttyS0 because that would mean you want to fool it into accepting an alternate version of reality. In the context of a device, this might mean getting it to read or write bytes it wasn't meant to, which doesn't make a whole lot of sense.

What you really want to do is to mock /dev/ttyS0, so that innocent bystanders think they are writing to a serial device driver, when in fact they're writing to your Perl program.

At one level this is rather trivial, just move the existing /dev/ttyS0 out of the way and install a FIFO in its place. On the other hand, this might annoy real users of the real serial port.

Can you not arrange your code to use some existsing test harness like Test::Device::SerialPort?.

• another intruder with the mooring in the heart of the Perl

Replies are listed 'Best First'.
Re^2: Spoof /dev/ttyS0
by akujbida (Acolyte) on Sep 25, 2008 at 06:18 UTC
    Quite right about the terminology, thanks. FIFO is just the pointer I wanted to hear. I tried the example on p433 of the Camel, and it told me I "will visit the Dung Pits of Glive soon", which is the best news I've heard about this all day. Many thanks, I'm on the road. BTW, the test harness, which I've previously considered, is very nice but requires change to the drivers.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://713433]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2022-05-18 14:28 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (71 votes). Check out past polls.