LinuxQuestions.org
Help answer threads with 0 replies.
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
 
LinkBack Search this Thread
Old 07-09-2008, 04:55 PM   #1
SPF
Member
 
Registered: Jul 2007
Location: /home
Distribution: Debian
Posts: 34

Rep: Reputation: 15
I/O Programming usb printer port


Hi,

I connected an usb printer port to my linux computer. After experimenting on an other computer with a 'normal' printer port, I wanted to try to extend the amount of I/O's using the usb solution.

The default address of the printer port is 0x378 (or 0x278 on some computers). Yes this is the old parallel port and it still works.
But my new computer doesn't have a parallel port. So I bought the usb printer/parallel port.

But now I have to find the address. Let's look at dmesg:
Code:
usb 1-3: new full speed USB device using ohci_hcd and address 3
usb 1-3: configuration #1 chosen from 1 choice
drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 3 if 0 alt 1 proto 2 vid 0x067B pid 0x2305
usbcore: registered new driver usblp
drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver
Hmm, 0x067B is the vid (Vendor ID) and 0x2305 is the pid (Product ID).

OK, let's look at lsusb -v:
Code:
Bus 001 Device 003: ID 067b:2305 Prolific Technology, Inc. PL2305 Parallel Port
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x067b Prolific Technology, Inc.
  idProduct          0x2305 PL2305 Parallel Port
  bcdDevice            2.02
  iManufacturer           1 Prolific Technology Inc.
  iProduct                2 IEEE-1284 Controller
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           78
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         7 Printer
      bInterfaceSubClass      1 Printer
      bInterfaceProtocol      1 Unidirectional
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass         7 Printer
      bInterfaceSubClass      1 Printer
      bInterfaceProtocol      2 Bidirectional
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       2
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0
      bInterfaceProtocol    255
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)
Hmm, a lot of info, but still no address.

Maybe:

Code:
cat /proc/ioports
0000-001f : dma1
0020-0021 : pic1
0040-0043 : timer0
0050-0053 : timer1
0060-006f : keyboard
0070-0077 : rtc
0080-008f : dma page reg
00a0-00a1 : pic2
00c0-00df : dma2
00f0-00ff : fpu
01f0-01f7 : ide0
03c0-03df : vesafb
03f6-03f6 : ide0
0cf8-0cff : PCI conf1
1000-101f : 0000:00:0f.0
6000-6007 : 0000:00:0f.0
6100-61ff : 0000:00:0f.0
6200-623f : 0000:00:0f.0
9c00-9c3f : 0000:00:0f.0
  9c00-9c03 : ACPI PM1a_EVT_BLK
  9c0c-9c0d : ACPI PM2_CNT_BLK
  9c10-9c13 : ACPI PM_TMR
  9c18-9c1f : ACPI GPE0_BLK
  9c28-9c29 : ACPI PM1a_CNT_BLK
9d00-9d7f : 0000:00:0f.0
9e00-9e07 : 0000:00:01.0
ac1c-ac1f : 0000:00:01.0
fc00-fcff : 0000:00:0d.0
  fc00-fcff : 8139too
fe00-fe7f : 0000:00:0f.3
  fe00-fe7f : CS5535 Audio
ff00-ff0f : 0000:00:0f.2
  ff00-ff07 : ide0
But no luck at all. I can't seem to find the address.

Program I used on the classic port:
http://tldp.org/HOWTO/IO-Port-Programming-9.html

If it's not possible to directly address the parallel port, I would like to receive some tips or a workaround.
 
Old 07-10-2008, 03:18 PM   #2
theNbomr
Senior Member
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 4,506

Rep: Reputation: 602Reputation: 602Reputation: 602Reputation: 602Reputation: 602Reputation: 602
USB parallel (and other USB dongles) usually include driver software that adapts their proprietary interface to the OS. Using the bare hardware protocols that worked for older hardware is unlikely to work for USB interfaced adapters. There are some such dongles that are advertised as being compatible with various software protection anti-piracy dongles. Such USB-printer ports would probably give you the best hope of working in the way you want, but I wouldn't be making any critical plans based on it.
--- rod.
 
Old 07-19-2008, 08:11 AM   #3
resetreset
Senior Member
 
Registered: Mar 2008
Location: India
Distribution: Dynebolic, Ubuntu 10.10
Posts: 1,177

Rep: Reputation: 48
Quote:
Originally Posted by SPF View Post


If it's not possible to directly address the parallel port, I would like to receive some tips or a workaround.

It's defnitely not SUPPOSED to let you, you're supposed to only read from the /dev file. I'm STILL unclear as to what Linux DOES, because I remember X windows in the old days locking up my system when it probed my video card, when Linux was still, of course, a protected mode system.
If it lets you, well, bad things can obviously happen, since 2 programs can then read or write from it together. Imagine your hard disk
 
Old 07-19-2008, 08:57 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 9,919

Rep: Reputation: 338Reputation: 338Reputation: 338Reputation: 338
I have this article somewhere..... I do not remember the details but it does cover the issues of connecting legacy hardware to your computer.

http://www.circellar.com/magazine/151toc.htm

As already posted a USB parallel port does not work like the hardware device built into the computer.
 
Old 02-08-2012, 12:52 PM   #5
quandJe
LQ Newbie
 
Registered: Aug 2011
Posts: 4

Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
I have this article somewhere..... I do not remember the details but it does cover the issues of connecting legacy hardware to your computer.

http://www.circellar.com/magazine/151toc.htm

As already posted a USB parallel port does not work like the hardware device built into the computer.
I have tried to
sudo rmmod lp0
So as to make my USB/parallel port converter function just as a parallel port but I am having a serious problem getting my LED to come on.
 
  


Reply

Tags
parallel, port, printer, usb


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printer Port Programming keikun_naruchan Programming 14 03-07-2011 06:23 PM
USB Serial Port Programming for PCDJ DAC-2 Controller Hexstatic Programming 1 09-10-2007 05:31 PM
cannot find usb port of my connected printer nocturna_gr Debian 1 08-10-2006 07:29 AM
USB-parallel port printer Devenpillay Linux - Laptop and Netbook 1 09-07-2004 09:26 AM
[C++/Kylix]USB port programming Tantalos Programming 2 08-29-2004 02:42 AM


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

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration