Question

Parallel port emulator/Virtual parallel port

Asked by: labreuer

I have designed a microprocessor setup to convert a serial interface to a parallel interface to facilitate installing parallel devices off of a serial port switch (connected to the computers via ethernet).  What I think I need is to have a virtual parallel port driver that the driver for the device connects to, so that it thinks it's connected to a standard parallel port.  Does such a thing exist and if not, would it be hard to implement for A) myself, knowing some C++ but not much about linux B) somebody who knows a decent amount of linux?

Thanks in advance,
Luke Breuer

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2003-12-19 at 11:59:04ID20830835
Tags

parallel

,

port

Topics

Linux Programming

,

Tivoli Storage Manager

Participating Experts
1
Points
500
Comments
13

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Parallel port Ethernet adapter?
    Can anyone recommend a good parallel-port Ethernet adapter for use with Linux? I understand Xircom's won't work, and would appreciate names and guidance from users of other vendors' gear. TIA David Newman
  2. Parallel Port to UTP ethernet connector
    A laptop is without PCMCIA slot. But has Parallel port I want to know which Manufacturer or vendor supprot this type of product. PC is having Windows 95 with RJ11 interface
  3. Project on Oracle Parallel server on sun cluster
    Hi , Can I get a document on project done on oracle parallel server on sun cluster . Please help ,Thanks in advance. With kind regards
  4. Parallelism Software
    Does anybody know how to write parallelism software using the windows api? (If it is even possible) I've created a would-be-cluster using 3 P4's running windows xp but I need to write some parallelism software to get the cluster to work. I don't want to buy any software becau...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: kiffneyPosted on 2003-12-19 at 14:45:48ID: 9975565

Can you explain the actual setup a bit better?  

It seemed like you were talking about a microprocessor that is connected to a physical RS-232 serial port which gets serial data and converts it to parallel data, demultiplexing it at the same time (sending it to various physical parallel ports).  

Then you mentioned a serial port switch and an ethernet connection and I got lost.  

Writing a device driver in linux that appears to be a parallel port (acts as if it were /dev/lp0) is no problem, nor is writing one that appears to be a serial port (/dev/ttyS0), and once the data got to the driver you could pretty much do as you wished.  

But I am sure I don't yet understand exactly what you want to do.

 

by: labreuerPosted on 2003-12-19 at 17:28:56ID: 9976220

You've answered most of it, let me clarify a bit:  There are a few computers, networked together and to the serial port switch, i.e. a box with 32 serial ports and an ethernet port.  We *can* connect the parallel devices directly to the computers, but that would make a computer failure potentially catastrophic, so we want the parallel ports to be accessed over the serial ports on the serial port switch, which requires a parallel-serial converter microprocessor.  What is needed is a virtual linux driver that looks like a parallel port, which you said would be easy.  I assume that with that written, the driver for the controller can be told to access the virtual parallel port.

With that said, what is required in writing this driver?  I don't need elaborate details, as I probably will not be doing it myself.  Could you give me an outline of what is required?

Thanks.

 

by: kiffneyPosted on 2003-12-19 at 18:26:44ID: 9976310

Maybe I'm being dense but I still don't see the path the data is actually going.  Is it

Linux computer - Ethernet - ethernet port on serial switch - serial switch serial port - your microprocessor - parallel port?

or is it

Linux computer - serial port - serial port on serial switch - another serial port on serial port switch - your microprocessor - parallel port?

or something else?

And why do you want the driver to be a 'virtual' parallel port?  By that do you mean the driver should appear to user software to be a parallel port device, but it's really connecting to something else?  What's that something else it's really connecting to?  The serial port? The ethernet port? Or what? Is there a reason the data can't simply go out the real serial/ethernet port and the hardware handles all the conversions?

At any rate, Linux device drivers are really easy to write.  /usr/src/linux/drivers/char/lp.c  and drivers/parport* should give you a start, as well as Alessandro Rubini's 'Linux Device Drivers' book.  The chapter on char drivers is online at http://www.xml.com/ldd/chapter/book/ch03.html.  If  you  are targeting the 2.6 kernel series, there are some changes; I don't know if they are covered in the second edition of his book, but the first edition was good and covered all the bases.

 

by: labreuerPosted on 2003-12-19 at 19:09:45ID: 9976373

The former.  All the computers are networked together on ethernet, along with the switch.  The serial ports are exclusively for controllers and data devices.

I figured that "virtual" was the right word to use.  The driver I would write would talk to the serial port switch, and specifically the serial port the microprocessor is running on.  The driver for any specific actuator would only see the two endpoints of the chain you described.

 

by: kiffneyPosted on 2003-12-20 at 05:35:34ID: 9977994

It doesn't seem to me that you need any driver other than the existing serial port driver, if the data is going in/out of the Linux box through the serial port to the serial port switch.  I'm assuming the information needed to talk to the switch is going to be going through the serial port data stream anyway, and the serial port switch looks for special escape codes to direct the data. Unless you are using the modem control pins (DTR, DTS, etc) in a non-standard way?

It might be possible to write one driver that installed several fake actuator devices (/dev/actuator1, /dev/actuator2) and when it got the data from any device file, looked up what needed to be done to get the data to the actuator, perhaps by reading an initialization file on startup - there are examples of setting up a driver module that creates several device files in the Rubini book.

 

by: kiffneyPosted on 2003-12-20 at 05:37:32ID: 9977999

I left out of the last comment that this driver, once it got data for /dev/actuator0, would then resend the data through the regular serial port driver along with any other control info needed to get the data to the right actuator.  

 

by: labreuerPosted on 2003-12-20 at 06:09:28ID: 9978043

You misread my last comment -- the computers are networked together and to the switch with ETHERNET.  When I said "the former," I was referring to:

Linux computer - Ethernet - ethernet port on serial switch - serial switch serial port - your microprocessor - parallel port?

 

by: kiffneyPosted on 2003-12-20 at 07:37:16ID: 9978263

OK, I missed that.  Even so, the answer to your question, can it be done? yes. Is it hard to implement for a programmer knowledgeable in C? no, not very, as linux device interface is well designed and fairly simple.  The more linux you know, the better, but the things you can do in a driver are limited anyway so there's not so many ways to go wrong.  The Rubini book is the best guide I know of.  

The ways I think you can do this are very much the same as I described above.

1) don't write any driver at all - in your control software, make a socket connection over Ethernet to the serial port switch and send the data that way using standard socket open, send, recv calls, and packing the special data for the serial port switch addressing of the actuators into the data sent over the socket

or

2) if you really want to go the driver route, write a virtual driver that installs several /dev/actuatorN device files, and within that driver handle the socket connections to the ethernet switch and the sending of data

(1) sounds easier to me, but if you like (2), your developer should get the Rubini book and start poking around in there, and looking at the source in /usr/src/linux/drivers/.

 

by: labreuerPosted on 2003-12-20 at 11:05:59ID: 9978998

Thanks.

The reason for a driver is that there already *is* a driver for the actuator, which needs to talk to a parallel port.  So either that driver is to be re-written, which could be tricky, or we just have it connect to the to-be-written virtual parallel port.

 

by: kiffneyPosted on 2003-12-21 at 10:45:34ID: 9981798

You might want to take your points back, as you just mentioned a critical piece of information - that you already had a driver writing to i/o ports that you hoped to reuse.

I didn't know you already had a driver that expects to talk to an i/o port. Is it actually making inb and outb calls to a specific io port?. If you hope to intercept those bytes as they are written to the port, that's probably not going to happen (at least, I can't think of how you could do that in a driver).  You are going to have to rewrite the driver.  If by chance the driver makes calls to /dev/port (which I doubt; in that case you would not even need a driver) you could possibly write a /dev/port substitute that intercepted the calls.  

If the driver is doing inb, outb calls, to make the rewriting of the driver as painless as possible, what you could do is write a substitute  function with similar parameters to inb, outb and such calls that sent the data over Ethernet via socket calls as described above.  This function could live in a separate driver that exposed these functions to your existing driver, and took care of the Ethernet stuff, the serial port switch management, etc.  But this will require some rewriting of your existing driver.

I should note that, within a device driver, you don't actually make calls to the socket interface, as is in the C library, but the kernel has similar routines some of which are defined in linux/net/socket.c; take a look  there for details of making ethernet connections in a driver.

 

by: labreuerPosted on 2003-12-21 at 10:55:21ID: 9981831

When I program for the parallel port in windows, there are several possible addresses for the parallel port.  I would hope the driver for the actuator lets the programmer choose the port it connects to.  Thus, would it not be simple to have an address that points to a virtual port, and tell the driver for the actuator to use that address?  I am only arguing logically -- I do not know if either Linux or Windows supports this.

 

by: kiffneyPosted on 2003-12-22 at 07:17:03ID: 9985246

Yes, there are several different devices representing parallel ports that you write to - LPT1, LPT2, etc.  As long as your software writes to this device, the device driver is able to intercept them and redirect to various physical IO ports available to the processor.  But your situation is (I think) different.  Your /dev/actuator0 writes to an actual physical IO port, so in order to send the data out over a socket, you're going to have to rewrite the driver to not do inb(), outb() calls, but instead to call other functions that open a socket, add whatever addressing data the serial port box needs, and send the data out the Ethernet port.  There's no way I know of to intercept writes to an actual IO port in Linux unless you are working within a virtual machine (like dosemu, wine, or vmware).  So the existing device driver will have to be rewritten.  If you want to keep the rewriting to the minimum, you can write another module that exports the functions that replace inb, outb, so the existing driver is minimally modified and the other module/driver does the actual ethernet/serial stuff.  You also should know that you can't use the socket functions directly as they are in the C library, but the kernel exports other functions that do the same thing  - look in linux/socket.h for the actual calls, and the source of khttpd in the kernel files will tell you a lot about how to do sockets within the kernel.

 

by: labreuerPosted on 2003-12-22 at 07:57:04ID: 9985567

Actually, I don't know whether the device driver writes directly to a port or not -- I'll check that out.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...