LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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


Reply
  Search this Thread
Old 06-04-2009, 01:23 AM   #1
eteck
Member
 
Registered: Oct 2003
Location: In a Cave on Mars
Posts: 52

Rep: Reputation: 15
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.
 
Old 06-04-2009, 07:30 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
A quick forum search turned up: http://www.linuxquestions.org/questi...r-port-654695/
 
Old 06-04-2009, 09:30 PM   #3
eteck
Member
 
Registered: Oct 2003
Location: In a Cave on Mars
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Matir View Post
Yeah read that before, but doesn't really answer my question.
 
Old 06-04-2009, 09:40 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
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)
 
Old 06-04-2009, 09:53 PM   #5
eteck
Member
 
Registered: Oct 2003
Location: In a Cave on Mars
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Matir View Post
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)?
 
Old 06-04-2009, 09:57 PM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
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
 
Old 06-04-2009, 10:15 PM   #7
eteck
Member
 
Registered: Oct 2003
Location: In a Cave on Mars
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Matir View Post
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
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.
 
Old 06-04-2009, 11:42 PM   #8
Marko Hyvärinen
LQ Newbie
 
Registered: May 2009
Posts: 24

Rep: Reputation: 15
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
 
Old 06-05-2009, 06:35 AM   #9
TimothyEBaldwin
Member
 
Registered: Mar 2009
Posts: 249

Rep: Reputation: 27
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
usb-parallel port adapter al.basili Linux - Hardware 0 12-01-2005 01:56 PM
USB-Parallel Port Adapter FliesLikeABrick Linux - Hardware 6 09-29-2005 12:47 PM
Adding Parallel Port Controller Card KenGr Linux - Hardware 0 05-23-2005 10:18 AM
parallel vs usb port raysr Mandriva 1 09-12-2004 12:14 AM
USB-parallel port printer Devenpillay Linux - Laptop and Netbook 1 09-07-2004 09:26 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration