touchgadget / esp32-usb-host-demos

ESP32S2 Arduino USB host printer, MIDI, and keyboard demos
MIT License
112 stars 15 forks source link

Could it supports to send "GET_DEVICE_ID" to get the usb printer info, like the "usb_printerid" cmd #6

Open yourchanges opened 2 years ago

yourchanges commented 2 years ago

Your lib is great, works on esp32s3!!!

Could it supports to send "GET_DEVICE_ID" to get the usb printer info, like the "usb_printerid" cmd.

To follow the spec: https://www.usb.org/sites/default/files/usbprint11a021811.pdf , and use linux cmd usb_printerid, we can easy get the usb printer DEVICE_ID info:

sudo usb_printerid /dev/usb/lp2
GET_DEVICE_ID string:
MANUFACTURER:Gprinter ;COMMAND SET:TSC;MODEL:GP-3120TUC;CLASS:PRINTER;PROTOCOLS:IEEE1284.4;OPTIONS:INTPSRVR

Does it possible?

yourchanges commented 2 years ago

here is the usb traffic related to the GET_DEVICE_ID

23.0  CTL    00 09 01 00  00 00 00 00                                                                                SET CONFIG              89.1.0       
  23.0  CTL    80 06 00 01  00 00 12 00                                                                                GET DESCRIPTOR          90.1.0       
  23.0  IN     12 01 00 02  00 00 00 40  f0 03 2a 00  00 01 01 04  03 01                                               .......@..*.....        90.2.0       
  23.0  CTL    a1 00 00 00  00 00 f1 03                                                                                GET DEVICE ID           91.1.0       
  23.0  IN     00 8c 4d 46  47 3a 48 65  77 6c 65 74  74 2d 50 61  63 6b 61 72  64 3b 4d 44  4c 3a 48 50  20 4c 61 73  ..MFG:Hewlett-Pa        91.2.0       
               65 72 4a 65  74 20 50 72  6f 66 65 73  73 69 6f 6e  61 6c 20 50  31 31 30 38  3b 43 4d 44  3a 5a 4a 53  erJet Profession        91.2.32      
               2c 50 4a 4c  2c 41 43 4c  2c 48 54 54  50 3b 43 4c  53 3a 50 52  49 4e 54 45  52 3b 44 45  53 3a 48 50  ,PJL,ACL,HTTP;CL        91.2.64      
               20 4c 61 73  65 72 4a 65  74 20 50 72  6f 66 65 73  73 69 6f 6e  61 6c 20 50  31 31 30 38  3b 46 57 56   LaserJet Profes        91.2.96      
               45 52 3a 32  30 31 32 30  38 31 34 3b                                                                   ER:20120814;            91.2.128     
  24.0  CTL    80 06 00 01  00 00 12 00                                                                                GET DESCRIPTOR          92.1.0       
  24.0  IN     12 01 00 02  00 00 00 40  f0 03 2a 00  00 01 01 06  03 01                                               .......@..*.....        92.2.0