Online C#USB communication information is relatively small, basically is based on Libusbdotnet and Cyusb, about the printer equipment and there is a opos.
This post is based on libusbdotnet.
1. Download and install the Libusbdotnet installation file.
2. Run the filter Wizard, Install a device filter. Install a USB device that requires communication.
3. Build a simple console project to test for printing information that requires communication equipment.
Related code:
Reference
Using libusbdotnet;using libusbdotnet.main;using libusbdotnet.info;
Printusbinfo
public static void Printusbinfo () {Usbdevice usbdevice = null; Usbregdevicelist alldevices = usbdevice.alldevices; Console.WriteLine ("Found {0} devices", Alldevices.count); foreach (Usbregistry usbregistry in alldevices) {Console.WriteLine ("Got device: {0}\r\n", Usbre Gistry. FullName); if (Usbregistry.open (out Usbdevice)) {Console.WriteLine ("Device information\r\n-------- ----------"); Console.WriteLine ("{0}", usbDevice.Info.ToString ()); Console.WriteLine ("VID & PID: {0} {1}", UsbDevice.Info.Descriptor.VendorID, UsbDevice.Info.Descriptor.ProductID) ; Console.WriteLine ("\r\ndevice configuration\r\n--------------------"); foreach (Usbconfiginfo usbconfiginfo in Usbdevice.configs) {Console.WriteLine (" {0} ", usbconfiginfo.tostring ()); Console.WriteLine ("\r\ndevice interface list\r\n---------------------"); readonlycollection<usbinterfaceinfo> interfacelist = usbconfiginfo.interfaceinfolist; foreach (Usbinterfaceinfo usbinterfaceinfo in interfacelist) {CONSOLE.W Riteline ("{0}", usbinterfaceinfo.tostring ()); Console.WriteLine ("\r\ndevice endpoint list\r\n--------------------"); readonlycollection<usbendpointinfo> endpointlist = usbinterfaceinfo.endpointinfolist; foreach (Usbendpointinfo usbendpointinfo in endpointlist) {Cons Ole. WriteLine ("{0}", usbendpointinfo.tostring ()); }}} usbdevice.close (); } Console.WriteLine ("\ r \ n-----Device Information Finished-----\ r \ n "); } }
Call
public static void Main (string[] args) { printusbinfo (); Wait for user input : Console.readkey (); }