5

I am trying to get a USB-to-Parallel IEEE-1284 cable which is showed as USB Printing Support in Device manager to work as a LPT port and tried the answer here. Using this command:

NET USE LPT1: \\[Computer-Name]\Printer /PERSISTENT:YES

The command execute successfully but I can't see the LPT1 in Hardware Devices to get the address to write to it. I know the port I create exits because I made a Java application that lists Serial and Parallel ports using RXTX lib, here is the output:

enter image description here

I added all that LPT ports with the NET command because my PC doesn't have any. But I don't see them anywhere to get the address and RXTX lib doesn't allow me to get port address AFAIK. Any ideas how to access ports?

EDIT:

Ok, to clarify things a little, I have a USB-to-Parallel IEEE-1284, when you connect it to a Windows XP machine it is showed as an USB Printing Support device so It doesn't appear as a LPT port because it is designed to work with printers.

I created a Printer with Generic/Text driver and connected it to USB001 port because it is the port of the USB cable. Then I share the printer and create a LPT port using NET command. Now I want to write data to that LPT port as I would do with any other native LPT port using for example InpOut32.dll.

If it is not possible to access the port on that way, how can I get access to the port to write/read raw data to it? Not to print a document but to write/read raw data to it as you would do with any parallel port.

10
  • Can't you do something like public static final String PARALLEL_PORT = "LPT1"; as shown in the Parallel Communications example code?
    – martineau
    Sep 18, 2013 at 4:19
  • Historically, LPT1's hardware port address is 0x3BC (see Interfaces).
    – martineau
    Sep 18, 2013 at 4:25
  • No, I have to use it in another program and I need the port address. Yes, but the address is not the same for every port isn't it?
    – Andres
    Sep 18, 2013 at 10:06
  • LPT2 and 3 have different fixed addresses (0x378 and 0x278 respectively). These three addresses are the same on all IBM PC-compatible systems.
    – martineau
    Sep 18, 2013 at 12:42
  • This doesn't seems to work with Parallel Ports created with this method
    – Andres
    Sep 25, 2013 at 19:04

4 Answers 4

1
+100

Ok. So you connected a parallel device/printer via a "USB-to-Parallel IEEE-1284"-cable to the USB-port of your computer. Now you need to directly communicate to it. I understand you can't change the software directly to communicate with modern ports like USB001 etc. like the drivers of scanners do. And the software you have needs to communicate by normal protocol for old-LPTx ports (i.e. 0x378 instead of LPT1 etc.)

That leaves you with one option and that is "emulation". This should be done by the driver which came with the "USB-to-Parallel IEEE-1284"-cable. This driver should make a LPTx port and capture port-communication etc. But most (if not all) of these adapters come with drivers who emulate an USB-printer. In most cases this is the easiest (and even in case of old DOS-programs this can be solved with a NET command) but when it comes to real port-communication it is useless.

So you need to find a program that can emulate a LPTx (and its ports) and bidirectionally communicate with (any) USB-driver on your computer. I have not found one (yet).

The only thing useful i found was this Converter From USB To Parallel. This one emulates the LPTx and ports and communicates directly with the adapter. I have not tested this myself but the info-page looks promising. From the help-file:

The USB2LPT device and its driver enables redirecting of port access by random application software to a USB-attached parallel port, i.e. emulating a parallel port via USB. This unique solution works on all USB supporting Windows operating systems.

It does label its own driver as "Driver unstable" but you'll get the idea for what you're looking for. It also needs a special USB2LPT-adapter though. From its faq-page:

Q3. Can I use the USB2LPT.SYS driver with a regular (cheap) USB to parallel printer adapter?
A. Of course not! It's never possible due to design limitations of such adapters. See below.

It also lists as a minus for itself its Reduced speed due to emulation (expect 10..100 times slower). But it will allow communication with Base address same as built-in (378h, 278h). If you like you can make your own adapter. The schematics are all on the site. Here you can find complete instructions (including videos) on how to build one. Or else you can mail him for details on how to get one.

USB2LPT-adapter USB2LPT-adapter Converter From USB To Parallel

4
  • Yes, I read about it a few weeks ago but I have to buy their cable and I am trying to get to work my cable first. Thank you!
    – Andres
    Sep 30, 2013 at 15:35
  • I thought perhaps you were capable of building your own :) (instructions are included). But you're right. This software won't work without that adapter. A pure software solution would be best but hard to find. On here there was a suggestion to modify the source code to interact with any hardware/adapter but i haven't found anyone who has done this.
    – Rik
    Sep 30, 2013 at 16:00
  • Maybe this article is of interest. It only shows writing to a usb-lpt adapter but it should work with the normal ones. It's pretty 'do it youself' but it shows it's no easy task to write (i.e. toggle a bit) (not to mention read) the usb-lpt adapter which is meant for normal printers (and not other communication devices).
    – Rik
    Sep 30, 2013 at 22:51
  • And finally a note on USB parallel port adapters.
    – Rik
    Sep 30, 2013 at 23:05
1

I think that you may be going about this all wrong. You should not be using "NET USE" but rather using the adapter's software driver to associate a virtual printer port with the USB port. Rik has posted a screenshot of how this works. Only if the adapter's software allows it, should you then be able to write as if that physical port existed.

The NET USE LPT1 command that you showed is for when you connect to a printer on your own or another computer, and set that printer as your local (LPT1) printer. It is based on printing to the device name LPT1 and then redirecting that, which you have said your software won't do (requiring a hardware port).

Here is a driver from Startech, that makes some of these cables, but I don't know if it will work for you; it does work with some other models (including ones that I've owned): http://sgcdn.startech.com/005329/media/sets/ASIX_MosChip-MCS7715_Drivers/ASIX_MCS7715.zip

In the meanwhile, get rid of that NET USE command; it's really not helping you right now, and if you could get it to work at all with the local printer, would still require you to be writing to the LPT1 device (not to the hardware location where it would be, if only it existed.)

1
  • I unninstalled the driver Windows XP was installing for the cable and installed this one but didn't work. No I can't even manage to make Windows to install a driver for the cable.
    – Andres
    Sep 30, 2013 at 15:34
0

You will need the .NET-Framework and PowerShell, but with this script, you can get access to a list of any Parallel-Ports installed on your system.(+Additional informations)

$strComputer = "." 

$colItems = get-wmiobject -class "Win32_ParallelPort" -namespace "root\CIMV2" ` 
-computername $strComputer 

foreach ($objItem in $colItems) { 
      write-host "Availability: " $objItem.Availability 
      write-host "Capabilities: " $objItem.Capabilities 
      write-host "Capability Descriptions: " $objItem.CapabilityDescriptions 
      write-host "Caption: " $objItem.Caption 
      write-host "Configuration Manager Error Code: " $objItem.ConfigManagerErrorCode 
      write-host "Configuration Manager User Configuration: " $objItem.ConfigManagerUserConfig 
      write-host "Creation Class Name: " $objItem.CreationClassName 
      write-host "Description: " $objItem.Description 
      write-host "Device ID: " $objItem.DeviceID 
      write-host "DMA Support: " $objItem.DMASupport 
      write-host "Error Cleared: " $objItem.ErrorCleared 
      write-host "Error Description: " $objItem.ErrorDescription 
      write-host "Installation Date: " $objItem.InstallDate 
      write-host "Last Error Code: " $objItem.LastErrorCode 
      write-host "Maximum Number Controlled: " $objItem.MaxNumberControlled 
      write-host "Name: " $objItem.Name 
      write-host "Operating System Auto-Discovered: " $objItem.OSAutoDiscovered 
      write-host "PNP DeviceID: " $objItem.PNPDeviceID 
      write-host "Powe rManagement Capabilities: " $objItem.PowerManagementCapabilities 
      write-host "Power Management Supported: " $objItem.PowerManagementSupported 
      write-host "ProtocolS upported: " $objItem.ProtocolSupported 
      write-host "Status: " $objItem.Status 
      write-host "Status Information: " $objItem.StatusInfo 
      write-host "System Creation Class Name: " $objItem.SystemCreationClassName 
      write-host "System Name: " $objItem.SystemName 
      write-host "Time Of Last Reset: " $objItem.TimeOfLastReset 
      write-host 
} 

Source:Technet-Microsoft

5
  • I founded it searching over internet but I don't know how to execute Power-Shell scripts and Power-Shell seems to be a paid software
    – Andres
    Sep 25, 2013 at 19:36
  • @Andres It is a freeware. But your Windows version has to be a valid one. So no cracked or something. Because during the installation, it will check, if there is a original windows xp-version. Download
    – Christian
    Sep 25, 2013 at 19:40
  • I tested the script and it doesn't works on PowerShell v2.0
    – Andres
    Sep 25, 2013 at 20:12
  • Ok got it working but it doesn't give me the parallel ports created with NET
    – Andres
    Sep 25, 2013 at 21:25
  • The parallel port is not created with the NET USE command. The command only tells the system that any output that was aimed at LPT1 should instead be sent to the printer at \\computername\printername.
    – Debra
    Sep 28, 2013 at 19:27
0

(I have rewritten my previous answer which didn't fit your case.)

The cable is apparently recognized by Windows, but the driver should have done some more extensive emulation for it to be directly available for writing.

This forces you to invent your own device, in this case a generic printer. It's entirely possible that this printer is unusable because it sends control-codes over the cable to which whatever device is connected on the other side doesn't know how to respond. A printer cable might in this case not be the best means of connecting devices.

The best I can find is in the article Getting a handle on usbprint.sys where a C program was developed for directly writing data to a printer by bypassing the print driver. You could possibly use this simple program as a template to develop your own program for writing the data to the cable.

For the program to work, one must find the GUID of the interface in Windows of the cable, assuming that the cable does have an accessible interface GUID. You will need to search the registry using regedit or the faster RegScanner.

9
  • Yes, on this way I create LPT1 and create a printer which prints on LPT1 port, but how I can assign this port to the USB-to-Parallel IEEE-1284 cable? Otherwise the printer is printing to the LPT1 virtual port.
    – Andres
    Sep 27, 2013 at 17:18
  • You say above that the NET USE LPT1: command has successfully connected LPT1 to the cable. If this is not the case, do you have in the "Add printer" dialog an available port named USB001 or similar.
    – harrymc
    Sep 27, 2013 at 17:26
  • Yes I created a printer which is connected to USB001 which is my cable, but I can't access to the LPT port. See my edited question please.
    – Andres
    Sep 28, 2013 at 1:38
  • You don't need the LPT, so better delete it. What you need is a local printer created with the driver of the real physical printer and using the USB port of the cable. Unplug all unnecessary USB devices while creating the printer. The port number is likely to be USB001, that I hope you will see in the ports list, which is the default virtual printer port in Windows for USB printers. USB002 only appears if USB001 is already in use.
    – harrymc
    Sep 28, 2013 at 6:04
  • In addition to the above : What make is your USB-to-Parallel cable and did you receive a drivers disc when you bought it?
    – harrymc
    Sep 28, 2013 at 10:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .