<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Getting a handle on usbprint.sys</title>
	<atom:link href="http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/</link>
	<description></description>
	<pubDate>Mon, 12 May 2008 11:19:24 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: David</title>
		<link>http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-9390</link>
		<dc:creator>David</dc:creator>
		<pubDate>Sun, 11 May 2008 21:25:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-9390</guid>
		<description>First, thank the blog owner for show us some of his great pieces!

To Dmitri,
Most printer don't required reverse data transfer, thus readfile can fail to get output from printer.
Most printer comunicated with printer using ieee-1284 device ID ( IOCTL_USBPRINT_GET_1284_ID) data pipe only. Bulk transfer from printer to PC is not nesasary.

To Brandon,
In VB6, I do in this ways.

'HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\DeviceClasses\{28d78fad-5a12-11d1-ae5b-0000f803a8c2}\##?#USB#Vid_4348&#38;Pid_5584#5&#38;13b4f648&#38;0&#38;1#{28d78fad-5a12-11d1-ae5b-0000f803a8c2}

Public Type guid: Data(3) As Long: End Type 'A GUID is 16 bytes long

Public Sub usbPrintGuid()
'{28d78fad-5a12-11d1-ae5b-0000f803a8c2}
    GUID_DEVINTERFACE_USBPRINT.Data(0) = &#38;H28D78FAD
    GUID_DEVINTERFACE_USBPRINT.Data(1) = &#38;H11D15A12
    GUID_DEVINTERFACE_USBPRINT.Data(2) = &#38;H5BAE
    GUID_DEVINTERFACE_USBPRINT.Data(3) = &#38;HC2A803F8
End Sub

 useGuid = GUID_DEVINTERFACE_USBPRINT
 PnPHandle&#38; = SetupDiGetClassDevs(useGuid.Data(0), 0, 0, &#38;H12)
  If (PnPHandle&#38; = -1) Then ErrorExit ("Could not attach to PnP node")
  
  Do While SetupDiEnumDeviceInterfaces(PnPHandle&#38;, 0, useGuid.Data(0), HidEntry&#38;, DeviceInterfaceData.cbsize)</description>
		<content:encoded><![CDATA[<p>First, thank the blog owner for show us some of his great pieces!</p>
<p>To Dmitri,<br />
Most printer don&#8217;t required reverse data transfer, thus readfile can fail to get output from printer.<br />
Most printer comunicated with printer using ieee-1284 device ID ( IOCTL_USBPRINT_GET_1284_ID) data pipe only. Bulk transfer from printer to PC is not nesasary.</p>
<p>To Brandon,<br />
In VB6, I do in this ways.</p>
<p>&#8216;HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\DeviceClasses\{28d78fad-5a12-11d1-ae5b-0000f803a8c2}\##?#USB#Vid_4348&amp;Pid_5584#5&amp;13b4f648&amp;0&amp;1#{28d78fad-5a12-11d1-ae5b-0000f803a8c2}</p>
<p>Public Type guid: Data(3) As Long: End Type &#8216;A GUID is 16 bytes long</p>
<p>Public Sub usbPrintGuid()<br />
&#8216;{28d78fad-5a12-11d1-ae5b-0000f803a8c2}<br />
    GUID_DEVINTERFACE_USBPRINT.Data(0) = &amp;H28D78FAD<br />
    GUID_DEVINTERFACE_USBPRINT.Data(1) = &amp;H11D15A12<br />
    GUID_DEVINTERFACE_USBPRINT.Data(2) = &amp;H5BAE<br />
    GUID_DEVINTERFACE_USBPRINT.Data(3) = &amp;HC2A803F8<br />
End Sub</p>
<p> useGuid = GUID_DEVINTERFACE_USBPRINT<br />
 PnPHandle&amp; = SetupDiGetClassDevs(useGuid.Data(0), 0, 0, &amp;H12)<br />
  If (PnPHandle&amp; = -1) Then ErrorExit (&#8221;Could not attach to PnP node&#8221;)</p>
<p>  Do While SetupDiEnumDeviceInterfaces(PnPHandle&amp;, 0, useGuid.Data(0), HidEntry&amp;, DeviceInterfaceData.cbsize)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon</title>
		<link>http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-9388</link>
		<dc:creator>Brandon</dc:creator>
		<pubDate>Thu, 08 May 2008 13:12:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-9388</guid>
		<description>Does anyone have this code for VB.NET 2005?

I can't find anything in the registry about GUIDs or the number you found either...</description>
		<content:encoded><![CDATA[<p>Does anyone have this code for VB.NET 2005?</p>
<p>I can&#8217;t find anything in the registry about GUIDs or the number you found either&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danny Lauwers</title>
		<link>http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-9339</link>
		<dc:creator>Danny Lauwers</dc:creator>
		<pubDate>Wed, 20 Feb 2008 23:15:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-9339</guid>
		<description>Hello,

Does anybody has this code working under .NET ? Is it possible to send some source code to start this USB stuff under .NET ?

I need to get the real-time status of an USB connected HP Laserjet to see if it is Out-Of-Paper. Reading about the GET_PORT_STATUS from the USBPrint specifications this would do the job.

Do you guys think it is possible ?

Tried to compile the original Code under VS2008 (VC++ Project) but I get lot's of errors. I guess I first need to install the latest SDK's and DDK's for the missing include files.

Any help is appriciated !

Thanks
Danny</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>Does anybody has this code working under .NET ? Is it possible to send some source code to start this USB stuff under .NET ?</p>
<p>I need to get the real-time status of an USB connected HP Laserjet to see if it is Out-Of-Paper. Reading about the GET_PORT_STATUS from the USBPrint specifications this would do the job.</p>
<p>Do you guys think it is possible ?</p>
<p>Tried to compile the original Code under VS2008 (VC++ Project) but I get lot&#8217;s of errors. I guess I first need to install the latest SDK&#8217;s and DDK&#8217;s for the missing include files.</p>
<p>Any help is appriciated !</p>
<p>Thanks<br />
Danny</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramgopal Kota</title>
		<link>http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-9291</link>
		<dc:creator>Ramgopal Kota</dc:creator>
		<pubDate>Mon, 07 Jan 2008 10:50:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-9291</guid>
		<description>Hi,
I am new to Windows driver programming.I am trying to solve a problem we are facing. We have a tool which works with Parallel Port ( LPT1/2/3) to be precise.
Our newer Desktops does not have LPT ports.Hence we thought of using USB to Parallel port cable, but they dont seem to work.
We want to add a ECP port (Dummy One say LPT1) and PIPE the USB Driver so that the data flows out of USB ?
Is it possible ? Is there any soultions for my problem ?</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I am new to Windows driver programming.I am trying to solve a problem we are facing. We have a tool which works with Parallel Port ( LPT1/2/3) to be precise.<br />
Our newer Desktops does not have LPT ports.Hence we thought of using USB to Parallel port cable, but they dont seem to work.<br />
We want to add a ECP port (Dummy One say LPT1) and PIPE the USB Driver so that the data flows out of USB ?<br />
Is it possible ? Is there any soultions for my problem ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yogish</title>
		<link>http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-9266</link>
		<dc:creator>Yogish</dc:creator>
		<pubDate>Wed, 21 Nov 2007 09:58:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-9266</guid>
		<description>Hi Peter,
I am new to the USB programming. I tried the following program with a usb connected mobile phone. But as in the previous discusion the device is not recognised in the device manager. In this situation can u kindly help me how to resolve this.

	while(SetupDiEnumDeviceInterfaces(hInfo, 0, (struct _GUID *)&#38;USBIODS_GUID, devicecount, &#38;Interface_Info)) 
	Here the control is not entering inside the while loop.
The PC does not have any drivers for mobile. In this condition , what changes i need to do for establishing the communication. Kindly help as this is a critical issue i am facing. 
Thankyou in advance</description>
		<content:encoded><![CDATA[<p>Hi Peter,<br />
I am new to the USB programming. I tried the following program with a usb connected mobile phone. But as in the previous discusion the device is not recognised in the device manager. In this situation can u kindly help me how to resolve this.</p>
<p>	while(SetupDiEnumDeviceInterfaces(hInfo, 0, (struct _GUID *)&amp;USBIODS_GUID, devicecount, &amp;Interface_Info))<br />
	Here the control is not entering inside the while loop.<br />
The PC does not have any drivers for mobile. In this condition , what changes i need to do for establishing the communication. Kindly help as this is a critical issue i am facing.<br />
Thankyou in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lawrence</title>
		<link>http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-9243</link>
		<dc:creator>Lawrence</dc:creator>
		<pubDate>Mon, 05 Nov 2007 03:25:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-9243</guid>
		<description>Hi Peter,

Your code serves well as a blueprint and guideline. At least I gained extremely high confidence seeing so many people having positive result with your code. That gave me the motivation to keep trying with your code (keep trying? allow me to explain later).

To be honest, I am a totally newbie who needs to implement USB printing. I tried #libusb, libusbdotnet, libusb-win32, tons of other references from Google, Microsoft MSDN, other people's blogs, forums, anything you could imagine in the world of Internet, I tried. However, I didn't have success with those solution.

Until I ran into your blog during endlessly googling for solution, it gave me some light in the end of tunnel. I really appreciate that. However, it isn't smooth sailing for me either. I am not too sure how other people in the comments 'got it work like a charm, magic, ....' That doesn't work for me from the first place, I really had hard time to get the code work.

I am totally new to WDK/DDK(in the past). I downloaded WDK for WIndows Vista to my Windows XP [note, WDK for Vista works for XP, according to Microsoft website]. The WDK is a monster download, it is 2.3GB. Setup the right include/lib paths. By the time I thought the code will work like a charm for me, I realize that the code contains some type definition which is unknown to the compiler. 

Then I need to find out which include file has the type definition. After that, I discovered that some of the API takes more argument than provided in the code. Being completely ignorant to the API, I need to do some best guess and googling around to temporarily workaround the compilation error. That added into uncertainty if I introduced some bug into the code and made it not working.

Then I ran into runtime issue - the code seems to abort somewhere when it is trying to get some USB information. Then I am not sure if the information is really needed for data writing.

After all those try, try and try, and of course heavily modification to the code, finally it works. And I still don't know why it will happen, due to different DDK version, compiler version? I don't know.

There are many comments, those are good suggestions, but I don't know which is the more workable one for me - some says it works like magic, some says removing the headers, some says compile without DDK, all made up some complicated to follow. 

At last, I just want to reiterate - [b]your blog and code are really good starting point for me. I wouldn't be successful without going through your code, although I did a lot changes to your original code to make it work. [/b]I want to thank you for that. On the other hand, I guess a complete project (with the ready-to-compile-and-build source code and makefile) will make your blog more complete.

I know you are just trying to help. But just that one tiny step from you, will be a big step of help for others struggling to get USB print work. Thanks again for your blog and code.</description>
		<content:encoded><![CDATA[<p>Hi Peter,</p>
<p>Your code serves well as a blueprint and guideline. At least I gained extremely high confidence seeing so many people having positive result with your code. That gave me the motivation to keep trying with your code (keep trying? allow me to explain later).</p>
<p>To be honest, I am a totally newbie who needs to implement USB printing. I tried #libusb, libusbdotnet, libusb-win32, tons of other references from Google, Microsoft MSDN, other people&#8217;s blogs, forums, anything you could imagine in the world of Internet, I tried. However, I didn&#8217;t have success with those solution.</p>
<p>Until I ran into your blog during endlessly googling for solution, it gave me some light in the end of tunnel. I really appreciate that. However, it isn&#8217;t smooth sailing for me either. I am not too sure how other people in the comments &#8216;got it work like a charm, magic, &#8230;.&#8217; That doesn&#8217;t work for me from the first place, I really had hard time to get the code work.</p>
<p>I am totally new to WDK/DDK(in the past). I downloaded WDK for WIndows Vista to my Windows XP [note, WDK for Vista works for XP, according to Microsoft website]. The WDK is a monster download, it is 2.3GB. Setup the right include/lib paths. By the time I thought the code will work like a charm for me, I realize that the code contains some type definition which is unknown to the compiler. </p>
<p>Then I need to find out which include file has the type definition. After that, I discovered that some of the API takes more argument than provided in the code. Being completely ignorant to the API, I need to do some best guess and googling around to temporarily workaround the compilation error. That added into uncertainty if I introduced some bug into the code and made it not working.</p>
<p>Then I ran into runtime issue - the code seems to abort somewhere when it is trying to get some USB information. Then I am not sure if the information is really needed for data writing.</p>
<p>After all those try, try and try, and of course heavily modification to the code, finally it works. And I still don&#8217;t know why it will happen, due to different DDK version, compiler version? I don&#8217;t know.</p>
<p>There are many comments, those are good suggestions, but I don&#8217;t know which is the more workable one for me - some says it works like magic, some says removing the headers, some says compile without DDK, all made up some complicated to follow. </p>
<p>At last, I just want to reiterate - [b]your blog and code are really good starting point for me. I wouldn&#8217;t be successful without going through your code, although I did a lot changes to your original code to make it work. [/b]I want to thank you for that. On the other hand, I guess a complete project (with the ready-to-compile-and-build source code and makefile) will make your blog more complete.</p>
<p>I know you are just trying to help. But just that one tiny step from you, will be a big step of help for others struggling to get USB print work. Thanks again for your blog and code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ingar Steinsland</title>
		<link>http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-9221</link>
		<dc:creator>Ingar Steinsland</dc:creator>
		<pubDate>Tue, 23 Oct 2007 13:07:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-9221</guid>
		<description>Hi. I have a code in a DLL that can open a direct communication line to a USB printer. I can give anyone that code for free. But, I have a serious problem: It seems that going in a tight loop calling WriteFile, overruns the printer. After some time it simply stops, and the communication fails. Any ideas?</description>
		<content:encoded><![CDATA[<p>Hi. I have a code in a DLL that can open a direct communication line to a USB printer. I can give anyone that code for free. But, I have a serious problem: It seems that going in a tight loop calling WriteFile, overruns the printer. After some time it simply stops, and the communication fails. Any ideas?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: henni</title>
		<link>http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-9220</link>
		<dc:creator>henni</dc:creator>
		<pubDate>Mon, 22 Oct 2007 10:50:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-9220</guid>
		<description>Controlling STROBE, AUTOFEED, INIT, and SELECTIN is not possible using the USB printer class protocol (such signals do not even exist in that specification). Therefore, there is no documented way to do so on the PL-2305 or similar chips. However, querying ERROR, SELECT, and PE &lt;i&gt;is&lt;/i&gt; possible using PL-2305, and therefore should be possible using usbprint.sys. ACK and BUSY are not known to USB printer specification, and if you can query these, you are lucky.
See my web site for a PL-2305 replacement that &lt;b&gt;does&lt;/b&gt; allow controlling all the lines - even without the hassle of getting the handle to usbprint.sys.</description>
		<content:encoded><![CDATA[<p>Controlling STROBE, AUTOFEED, INIT, and SELECTIN is not possible using the USB printer class protocol (such signals do not even exist in that specification). Therefore, there is no documented way to do so on the PL-2305 or similar chips. However, querying ERROR, SELECT, and PE <i>is</i> possible using PL-2305, and therefore should be possible using usbprint.sys. ACK and BUSY are not known to USB printer specification, and if you can query these, you are lucky.<br />
See my web site for a PL-2305 replacement that <b>does</b> allow controlling all the lines - even without the hassle of getting the handle to usbprint.sys.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Klaus</title>
		<link>http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-8984</link>
		<dc:creator>Klaus</dc:creator>
		<pubDate>Tue, 10 Jul 2007 10:55:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-8984</guid>
		<description>Could you give me an example of a typical contents of "interfacename" that is passed to CreateFile (line90). (Just to verify my efforts.) Many thanks!</description>
		<content:encoded><![CDATA[<p>Could you give me an example of a typical contents of &#8220;interfacename&#8221; that is passed to CreateFile (line90). (Just to verify my efforts.) Many thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sant</title>
		<link>http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-8850</link>
		<dc:creator>sant</dc:creator>
		<pubDate>Tue, 26 Jun 2007 07:14:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.peter.skarpetis.com/archives/2005/04/07/getting-a-handle-on-usbprintsys/#comment-8850</guid>
		<description>As i am new bee in device and human interactive world. 

its nice to find such people to share their code to the wold for free.

i ahev to write one device driver for USB drive with  own protocol. can any one suggest me where to start.
 
thanks</description>
		<content:encoded><![CDATA[<p>As i am new bee in device and human interactive world. </p>
<p>its nice to find such people to share their code to the wold for free.</p>
<p>i ahev to write one device driver for USB drive with  own protocol. can any one suggest me where to start.</p>
<p>thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>
