|
From: Dilip on 4 Apr 2008 15:59 Howdy Gurus I am not a low-level developer -- more of an application programmer, so I might've gotten some of my terminology wrong here. Do bear with me. We have a USB printer that we use in our application to print receipts and such. The drivers for this printer also create a virtual COM port for applications to communicate with it. Is there a way by which I can enumerate all the devices that are on the USB ports and determine what virtual COM port # they are sitting on? I know its possible to blindly open all the available COM ports (virtual or otherwise) one by one and query the device for its status and determine if its indeed a printer or not. However I don't want to go down this route because if by chance another device is sitting on one of the COM ports and I try to send some printer-specific control characters it kinda messes up that device. I did read up a lot of stuff on the internet and even came across this tiny program that displays all the USB devices connected to your PC -- (beware its a .PDF document containing CPP code) http://www.intel.com/intelpress/usb/examples/DUSBVC.PDF I managed to get that code to compile and it even printed information regarding my printer but I wasn't able to determine its COM port from that info. Any way out of this?
From: Maxim S. Shatskih on 4 Apr 2008 17:41 Add a proprietary IOCTL to your COM port implementation. -- Maxim Shatskih, Windows DDK MVP StorageCraft Corporation maxim(a)storagecraft.com http://www.storagecraft.com "Dilip" <rdilipk(a)lycos.com> wrote in message news:7b98a98a-0187-4da4-b3a2-6d37f3ab769a(a)a70g2000hsh.googlegroups.com... > Howdy Gurus > > I am not a low-level developer -- more of an application programmer, > so I might've gotten some of my terminology wrong here. Do bear with > me. > > We have a USB printer that we use in our application to print receipts > and such. The drivers for this printer also create a virtual COM port > for applications to communicate with it. Is there a way by which I > can enumerate all the devices that are on the USB ports and determine > what virtual COM port # they are sitting on? I know its possible to > blindly open all the available COM ports (virtual or otherwise) one by > one and query the device for its status and determine if its indeed a > printer or not. However I don't want to go down this route because if > by chance another device is sitting on one of the COM ports and I try > to send some printer-specific control characters it kinda messes up > that device. > > I did read up a lot of stuff on the internet and even came across this > tiny program that displays all the USB devices connected to your PC -- > (beware its a .PDF document containing CPP code) > http://www.intel.com/intelpress/usb/examples/DUSBVC.PDF > I managed to get that code to compile and it even printed information > regarding my printer but I wasn't able to determine its COM port from > that info. > > Any way out of this?
From: chris.aseltine on 4 Apr 2008 17:41 On Apr 4, 2:59 pm, Dilip <rdil...(a)lycos.com> wrote: > We have a USB printer that we use in our application to print receipts > and such. The drivers for this printer also create a virtual COM port > for applications to communicate with it. Is there a way by which I > can enumerate all the devices that are on the USB ports and determine > what virtual COM port # they are sitting on? My advice is to drop the idea of looking for COM ports altogether and look for device interfaces. Use SetupDiEnumDeviceInterfaces() to enumerate all instances of the COM port GUID (i.e. {86e0d1e0-8089-11d0-9ce4-08003e301f73}) and then look for your device's VID and PID in the symbolic link.
From: abei on 5 Apr 2008 01:16 My advice is to enumrate all COM port by COM class GUID then pick up your device by device name. "Dilip" <rdilipk(a)lycos.com> ??????:7b98a98a-0187-4da4-b3a2-6d37f3ab769a(a)a70g2000hsh.googlegroups.com... > Howdy Gurus > > I am not a low-level developer -- more of an application programmer, > so I might've gotten some of my terminology wrong here. Do bear with > me. > > We have a USB printer that we use in our application to print receipts > and such. The drivers for this printer also create a virtual COM port > for applications to communicate with it. Is there a way by which I > can enumerate all the devices that are on the USB ports and determine > what virtual COM port # they are sitting on? I know its possible to > blindly open all the available COM ports (virtual or otherwise) one by > one and query the device for its status and determine if its indeed a > printer or not. However I don't want to go down this route because if > by chance another device is sitting on one of the COM ports and I try > to send some printer-specific control characters it kinda messes up > that device. > > I did read up a lot of stuff on the internet and even came across this > tiny program that displays all the USB devices connected to your PC -- > (beware its a .PDF document containing CPP code) > http://www.intel.com/intelpress/usb/examples/DUSBVC.PDF > I managed to get that code to compile and it even printed information > regarding my printer but I wasn't able to determine its COM port from > that info. > > Any way out of this? >
From: chris.aseltine on 5 Apr 2008 08:35 On Apr 4, 4:41 pm, "Maxim S. Shatskih" <ma...(a)storagecraft.com> wrote: > Add a proprietary IOCTL to your COM port implementation. I think he wants to avoid communicating with unknown devices on the system altogether. What if a customer's system has a buggy COM port driver that crashes on unknown IOCTLs?
|
Next
|
Last
Pages: 1 2 3 Prev: What happened to the checked build Next: QoS API for packet scheduler |