• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 
May 01, 2024, 07:53:12 pm

News:

SMF - Just Installed!


Read / Write to a USB Printer

Started by chedges, December 09, 2008, 10:46:56 am

Previous topic - Next topic

chedges

Hello,

I'm trying to read and write data to a USB printers so I presume the USBpipedemo is the best place to start.

On loading the project and running it, I can see my device in the first combo so I select it, in the second and thrird combos
I select the Pipe [2] IN endpoint and Pipe [1] OUT endpoint repectively.

I presume I then need to check the Active checkbox? When I try this the checkbox immediately unchecks itself.

looking at the code, nrUSB1.Active is never true. Does this mean my printer will not work with this component?
Have you any suggestions? 

  if CheckBox1.Checked then begin
      nrUSB1.Active := True;
      if nrUSB1.Active then begin
        nrUSBPipePair1.PipeIn := TnrUsbPipe(ePipeIn.Items.Objects[ePipeIn.ItemIndex]).Index;
        nrUSBPipePair1.PipeOut := TnrUsbPipe(ePipeOut.Items.Objects[ePipeOut.ItemIndex]).Index;
      end;


Thanks for your assistance

Chris Hedges

chedges

Ok, I've trapped the exception

'USB device open is failed. Driver is unknown.'

doesn't sound good to me :(

The printer is installed but it shows as a HID device. Does this help at all?

Roman Novgorodov

Hello

Please note that TnrUSBPipePair needs the WinUSB driver for work with your USB device.
The WinUSB driver should be installed instead the your origin USB device driver.

WinUSB driver is released by Microsoft and it can support not all USB devices.

If you want to work with HID device, I recommend to use other nrComm Lib component - TnrHID.

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

chedges

Hi Roman,

I've tried the HIDDemo project but my printer does not appear on the list of devices?
any ideas?

thanks again,

Chris

Roman Novgorodov

Hello

You wrote:

QuoteThe printer is installed but it shows as a HID device


I'm sorry but I don't understand. Where do you see that printer is installed as HID device?
If you see your printer in HID device list in Windows Device Manager Tree,
then HIDDemod should show printer too.

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

chedges

Yes, I would have thought so too, but it does not unfortunately :(





Roman Novgorodov

Hello Chris

Thank you for your information. It is very interesting :-)

Please, when you will have a time, download the following program:
http://www.deepsoftware.com/download/hiddemo.zip

I have prepared the special debug version of HIDDemo.
Please run and exit this EXE. After that you can find a log file in same folder.
Please show me this LOG file.

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

chedges

thanks Roman, here is the log


[10/12/2008 08:17:55] nrComm Lib v8.19 Pro Windows XP [5.1.2600] Service Pack 3
[10/12/2008 08:17:55] Trying:{4D36E96F-E325-11CE-BFC1-08002BE10318}\0003
[10/12/2008 08:17:55] ... added.
[10/12/2008 08:17:55] Trying:{4D36E96B-E325-11CE-BFC1-08002BE10318}\0002
[10/12/2008 08:17:55] ... added.

Roman Novgorodov

Hello

It seems interesting more and more :-)


Please, if you have time, open Device Manager, select problem device, open device properties and select "Details" tab.
I need following inforamtion:

"Device Instance Id"
"Service"
"Enumerator"
"Bus relations"

You can select needed parameter, click to list box (below) and use Ctrl+C for copy value into clipboard.

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

chedges

As Requested :)

"Device Instance Id"  USB\VID_0A43&PID_0201\0000176935
"Service"                 WinDriver
"Enumerator"            USB
"Bus relations"          blank?

Roman Novgorodov

Hello

Thank you for information.

It seems like your printer is not HID device at all :-)

I don't understand why Device Manager shows it as HID Devices :-(

Roman Novgorodov
DeepSosftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

chedges

Thanks for your efforts Roman,

I think I will contact the manufacturer, perhaps there is some issue with
their driver or it is written in a non-standerd manner

:)

chedges

HI Roman,

I have finally got some firmware updates etc to allow my printer to be successfully "seen" by the nrComm HID demos.

I'm now looking for some resources that will explain how I should read and write data to and from the printer (I need to read the printer status).

Do you have any help files or even better a demo that would demonstrate the HID components usage. There appears to be no mention of the HID controls in the help file that ships with the nrComm eval version.

Thanks again,

Chris Hedges

Roman Novgorodov

Hi Chris

I glad that you have a small progress with your enigmatic device.

You can use HIDDemo project and see how it can read the incoming HID reports. Please select needed HID device and open it (click checkbox).
After that log will show all incoming bytes at bottom of application window.

If you want to write data, you can use TnrHID.SendChar(), TnrHID.SendString(), TnrHID.WriteReport() TnrHID.WriteFeature()
methods. Please note that a first byte of data is number of HID report.

Roman Novgordov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.