Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
06-04-2009, 01:23 AM
|
#1
|
|
Member
Registered: Oct 2003
Location: In a Cave on Mars
Posts: 51
Rep:
|
Parallel Port to USB controller and outb()
Hi guys,
From what I've tried and read I can't use outb() or inb() to control a parallel port (which connects via usb).
Any body know how to control a parallel port for systems without a physical parallel port connector (and hence have to buy and use a parallel port to usb converter).
Thx in advance.
|
|
|
|
06-04-2009, 07:30 PM
|
#2
|
|
Moderator
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,505
Rep: 
|
|
|
|
|
06-04-2009, 09:30 PM
|
#3
|
|
Member
Registered: Oct 2003
Location: In a Cave on Mars
Posts: 51
Original Poster
Rep:
|
Quote:
Originally Posted by Matir
|
Yeah read that before, but doesn't really answer my question.
|
|
|
|
06-04-2009, 09:40 PM
|
#4
|
|
Moderator
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,505
Rep: 
|
USB to Parallel Port adapters are supported by the usblp.c kernel driver, which provides a /dev/usb/lp* or /dev/usblp* device for each attached USB->PPT converter. You can read/write to these device files to communicate with devices that comply with IEEE 1284. outb() and inb() only work with devices that support direct port-based IO, which USB->PPT devices do not. (In fact, no USB devices that I'm aware of do, largely, I suspect, due to the ability to have up to 256 USB devices)
|
|
|
|
06-04-2009, 09:53 PM
|
#5
|
|
Member
Registered: Oct 2003
Location: In a Cave on Mars
Posts: 51
Original Poster
Rep:
|
Quote:
Originally Posted by Matir
USB to Parallel Port adapters are supported by the usblp.c kernel driver, which provides a /dev/usb/lp* or /dev/usblp* device for each attached USB->PPT converter. You can read/write to these device files to communicate with devices that comply with IEEE 1284. outb() and inb() only work with devices that support direct port-based IO, which USB->PPT devices do not. (In fact, no USB devices that I'm aware of do, largely, I suspect, due to the ability to have up to 256 USB devices)
|
So how do I set/read pin values for difference BASE's?
Code:
int fd = fopen("/dev/usblp0", "w");
write(fd, X, 1);
Will that set all pins X (e.g. if X = 20, will set the BASE pins to 0b10100)?
|
|
|
|
06-04-2009, 09:57 PM
|
#6
|
|
Moderator
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,505
Rep: 
|
You cannot arbitrarily set pins on these devices: they have built-in firmware to speak the IEEE-1284 for them, and speak in whole blocks back to the OS. See http://help.lockergnome.com/linux/se...ict487868.html
|
|
|
|
06-04-2009, 10:15 PM
|
#7
|
|
Member
Registered: Oct 2003
Location: In a Cave on Mars
Posts: 51
Original Poster
Rep:
|
Quote:
Originally Posted by Matir
|
So you are saying its not possible to set pins anymore? There must be a way to toggle pin 0 of the BASE. Can someone give me an example.
|
|
|
|
06-04-2009, 11:42 PM
|
#8
|
|
LQ Newbie
Registered: May 2009
Posts: 24
Rep:
|
i use also simple portcontrol software for linux console to drive my GSM modem. A thought came yo my mind that should you try telling that usb<>centronics - device that there is printer after it with ready-pin etc and then send byte-stuff to it ? You can set "pin" with boolean algebra, bit set etc...
Try something like that if you have such converter, i'd like to know also results.
Marko
|
|
|
|
06-05-2009, 06:35 AM
|
#9
|
|
Member
Registered: Mar 2009
Posts: 245
Rep:
|
There are some USB parallel port adapters that can do what is required, Linux has a driver for those based on the Lucent Technologies USS-720. However the latency introduced by USB can result in poor performance.
You should use the Parport API to do any bit fiddling.
Alternatively consider using a micro-controller that has USB support.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 10:22 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|