[lug] Newbie Question about Virtual Device Driver

Davide Del Vento davide.del.vento at gmail.com
Sat Feb 9 14:54:33 MST 2013


Scott,
My very first paid job in software (many years ago) was about
something similar to your project, but for a real hw.
Since we did not expected to have the hw in the lab for a long time
whereas we wanted to do the development of the software, we decided
the following approach which turned out to be a very good idea for the
rest of the project. The actual UI was talking to a server using a
simple protocol of our design, on top of TCP/IP. The server initially
was completely fake like your "driver" would. Then we've got some
files representing some possible real data coming from the hw and we
allowed in the server the option to replay those file. At that point
the server started to became smarter and we used it as simulator of
the hw, making it possible to run some serious tests. Eventually we've
got the real hw and therefore somebody made the actual driver for it
and we used it.
As I said, this choice has been very beneficial for us. In fact, I did
all my development work on Linux, whereas in the end they decided to
hook the hw to a windows-only box (I wasn't involved in the driver for
it). Porting the code of the UI to windows has been straightforward,
but I'm sure the "driver" (fake or real) would not. For some time we
kept the two pieces of software on two different boxes which also was
convenient (this wasn't an instrument you wanted to play with your
hands - actually I've never seen it myself :-)
Of course this approach might or might not work for you, but I believe
it's good that you think of this option.
Cheers,
Davide

On Sat, Feb 9, 2013 at 10:25 AM, Jonathan Corbet <corbet-bldrlug at lwn.net> wrote:
> On Sat, 9 Feb 2013 10:17:35 -0700
> Scott Jackson <scott.jackson.swe at gmail.com> wrote:
>
>> So what I need the Simulator to do is to
>> create the fake devices so that UDEV can find them and open a
>> communication line to them.  I envision the Simulated devices being
>> simple Socket Servers that respond to the incoming requests from the
>> managing software.
>
> The easiest approach might be to look at the UIO subsystem.  There's an
> oldish overview here:
>
>         https://lwn.net/Articles/232575/
>
> you'll find more current information in uio-howto in the kernel
> documentation directory.  UIO let's you put a little shim into the kernel
> and farm the real work out to user space, so your simulated driver can run
> in a relatively easy and safe environment.
>
> jon
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety



More information about the LUG mailing list