I'm developing communication with a slave USB device (POS printer). Everything is fine when I have a device with only one configuration so I can get the configuration descriptor, then get the endpoint and send data to this endpoint - that is working. The problem is that some of these slave devices/printers have two configuration descriptors, and ESP32 host only sees the first one, but I have to get access to the second one and write data to an endpoint from the second configuration. Here is data from USB Device Tree view.
How can I get access to endpoints from the second configuration?
Code: Select all
=========================== USB Port3 ===========================
Connection Status : 0x01 (Device is connected)
Port Chain : 1-3
Properties : 0x01
IsUserConnectable : yes
PortIsDebugCapable : no
PortHasMultiCompanions : no
PortConnectorIsTypeC : no
ConnectionIndex : 0x03 (Port 3)
CompanionIndex : 0
CompanionHubSymLnk : USB#ROOT_HUB30#4&38d51b6a&0&0#{f18a0e88-c30c-11d0-8815-00a0c906bed8}
CompanionPortNumber : 0x13 (Port 19)
-> CompanionPortChain : 1-19
========================== Summary =========================
Vendor ID : 0x20D1 (Dascom Europe GmbH)
Product ID : 0x7007
USB Version : 2.00
Port maximum Speed : High-Speed (Companion Port 1-19 supports SuperSpeed)
Device maximum Speed : High-Speed
Device Connection Speed : High-Speed
Self powered : no
Demanded Current : 0 mA
Used Endpoints : 3
======================== USB Device ========================
+++++++++++++++++ Device Information ++++++++++++++++++
Device Description : Uniwersalna drukarka USB
Device Path 1 : \\?\USB#VID_20D1&PID_7007#TP900021190243#{a5dcbf10-6530-11d2-901f-00c04fb951ed} (GUID_DEVINTERFACE_USB_DEVICE)
Device Path 2 : \\?\USB#VID_20D1&PID_7007#TP900021190243#{28d78fad-5a12-11d1-ae5b-0000f803a8c2} (GUID_DEVINTERFACE_USBPRINT)
Device Path 3 : \\?\USB#VID_20D1&PID_7007#TP900021190243#{a6782bce-4376-4de2-8096-70aa9e8fed19}
Kernel Name : \Device\USBPDO-4
Device ID : USB\VID_20D1&PID_7007\TP900021190243
Hardware IDs : USB\VID_20D1&PID_7007&REV_0300 USB\VID_20D1&PID_7007
Driver KeyName : {36fc9e60-c465-11cf-8056-444553540000}\0010 (GUID_DEVCLASS_USB)
Driver : \SystemRoot\System32\drivers\usbprint.sys (Version: 10.0.19041.1503 Date: 2022-02-10)
Driver Inf : C:\WINDOWS\inf\usbprint.inf
Legacy BusType : PNPBus
Class : USB
Class GUID : {36fc9e60-c465-11cf-8056-444553540000} (GUID_DEVCLASS_USB)
Service : usbprint
Enumerator : USB
Location Info : Port_#0003.Hub_#0001
Location IDs : PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(3), ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)#ACPI(HS03)
Container ID : {8e740817-c4c7-58e9-96cb-14565946798e}
Manufacturer Info : Microsoft
Capabilities : 0x94 (Removable, UniqueID, SurpriseRemovalOK)
Status : 0x0180600A (DN_DRIVER_LOADED, DN_STARTED, DN_DISABLEABLE, DN_REMOVABLE, DN_NT_ENUMERATOR, DN_NT_DRIVER)
Problem Code : 0
Address : 3
HcDisableSelectiveSuspend: 0
EnableSelectiveSuspend : 0
SelectiveSuspendEnabled : 0
EnhancedPowerMgmtEnabled : 0
IdleInWorkingState : 0
WakeFromSleepState : 0
Power State : D0 (supported: D0, D3, wake from D0)
Child Device 1 : TP90
Device ID : USBPRINT\OXHOOTP90\8&1DCEC2F3&0&USB001
Class : Printer
Driver KeyName : {4d36e979-e325-11ce-bfc1-08002be10318}\0002 (GUID_DEVCLASS_PRINTER)
Child Device 1 : TP90 (Lokalna kolejka wydruku)
Device ID : SWD\PRINTENUM\{A3A131AE-5950-436E-8FC7-3BB2D014BADE}
Class : PrintQueue
Driver KeyName : {1ed2bbf9-11f0-4084-b21f-ad83a8e6dcdc}\0010 (GUID_DEVCLASS_PRINTQUEUE)
+++++++++++++++++ Registry USB Flags +++++++++++++++++
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\20D170070300
osvc : REG_BINARY 00 00
---------------- Connection Information ---------------
Connection Index : 0x03 (Port 3)
Connection Status : 0x01 (DeviceConnected)
Current Config Value : 0x01 (Configuration 1)
Device Address : 0x0C (12)
Is Hub : 0x00 (no)
Device Bus Speed : 0x02 (High-Speed)
Number Of Open Pipes : 0x02 (2 pipes to data endpoints)
Pipe[0] : EndpointID=1 Direction=IN ScheduleOffset=0 Type=Bulk wMaxPacketSize=512 bInterval=0
Pipe[1] : EndpointID=2 Direction=OUT ScheduleOffset=0 Type=Bulk wMaxPacketSize=512 bInterval=0
Data (HexDump) : 03 00 00 00 12 01 00 02 02 00 00 40 D1 20 07 70 ...........@. .p
00 03 01 02 03 01 01 02 00 0C 00 02 00 00 00 01 ................
00 00 00 07 05 81 02 00 02 00 00 00 00 00 07 05 ................
02 02 00 02 00 00 00 00 00 .........
--------------- Connection Information V2 -------------
Connection Index : 0x03 (3)
Length : 0x10 (16 bytes)
SupportedUsbProtocols : 0x03
Usb110 : 1 (yes, port supports USB 1.1)
Usb200 : 1 (yes, port supports USB 2.0)
Usb300 : 0 (no, port not supports USB 3.0) -> but Companion Port 1-19 does
ReservedMBZ : 0x00
Flags : 0x00
DevIsOpAtSsOrHigher : 0 (Device is not operating at SuperSpeed or higher)
DevIsSsCapOrHigher : 0 (Device is not SuperSpeed capable or higher)
DevIsOpAtSsPlusOrHigher : 0 (Device is not operating at SuperSpeedPlus or higher)
DevIsSsPlusCapOrHigher : 0 (Device is not SuperSpeedPlus capable or higher)
ReservedMBZ : 0x00
Data (HexDump) : 03 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 ................
---------------------- Device Descriptor ----------------------
bLength : 0x12 (18 bytes)
bDescriptorType : 0x01 (Device Descriptor)
bcdUSB : 0x200 (USB Version 2.00)
bDeviceClass : 0x02 (Communications and CDC Control)
bDeviceSubClass : 0x00
bDeviceProtocol : 0x00 (No class specific protocol required)
bMaxPacketSize0 : 0x40 (64 bytes)
idVendor : 0x20D1 (Dascom Europe GmbH)
idProduct : 0x7007
bcdDevice : 0x0300
iManufacturer : 0x01 (String Descriptor 1)
Language 0x0409 : "OXHOO"
iProduct : 0x02 (String Descriptor 2)
Language 0x0409 : "TP90"
iSerialNumber : 0x03 (String Descriptor 3)
Language 0x0409 : "TP900021190243"
bNumConfigurations : 0x01 (1 Configuration)
Data (HexDump) : 12 01 00 02 02 00 00 40 D1 20 07 70 00 03 01 02 .......@. .p....
03 01 ..
------------------ Configuration Descriptor -------------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x02 (Configuration Descriptor)
wTotalLength : 0x0020 (32 bytes)
bNumInterfaces : 0x01 (1 Interface)
bConfigurationValue : 0x01 (Configuration 1)
iConfiguration : 0x00 (No String Descriptor)
bmAttributes : 0x80
D7: Reserved, set 1 : 0x01
D6: Self Powered : 0x00 (no)
D5: Remote Wakeup : 0x00 (no)
D4..0: Reserved, set 0 : 0x00
MaxPower : 0x00 (0 mA)
Data (HexDump) : 09 02 20 00 01 01 00 80 00 09 04 00 00 02 07 01 .. .............
02 00 07 05 81 02 00 02 00 07 05 02 02 00 02 00 ................
---------------- Interface Descriptor -----------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x00 (Interface 0)
bAlternateSetting : 0x00
bNumEndpoints : 0x02 (2 Endpoints)
bInterfaceClass : 0x07 (Printer)
bInterfaceSubClass : 0x01
bInterfaceProtocol : 0x02
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 00 00 02 07 01 02 00 .........
----------------- Endpoint Descriptor -----------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x81 (Direction=IN EndpointID=1)
bmAttributes : 0x02 (TransferType=Bulk)
wMaxPacketSize : 0x0200 (max 512 bytes)
bInterval : 0x00 (never NAKs)
Data (HexDump) : 07 05 81 02 00 02 00 .......
----------------- Endpoint Descriptor -----------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x02 (Direction=OUT EndpointID=2)
bmAttributes : 0x02 (TransferType=Bulk)
wMaxPacketSize : 0x0200 (max 512 bytes)
bInterval : 0x00 (never NAKs)
Data (HexDump) : 07 05 02 02 00 02 00 .......
--------- Device Qualifier Descriptor (for Full-Speed) --------
bLength : 0x0A (10 bytes)
bDescriptorType : 0x06 (Device_qualifier Descriptor)
bcdUSB : 0x200 (USB Version 2.00)
bDeviceClass : 0x00 (defined by the interface descriptors)
bDeviceSubClass : 0x00
bDeviceProtocol : 0x00
bMaxPacketSize0 : 0x40 (64 Bytes)
bNumConfigurations : 0x01 (1 other-speed configuration)
bReserved : 0x00
Data (HexDump) : 0A 06 00 02 00 00 00 40 01 00 .......@..
------------------ Configuration Descriptor -------------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x02 (Configuration Descriptor)
wTotalLength : 0x0020 (32 bytes)
bNumInterfaces : 0x01 (1 Interface)
bConfigurationValue : 0x01 (Configuration 1)
iConfiguration : 0x00 (No String Descriptor)
bmAttributes : 0x80
D7: Reserved, set 1 : 0x01
D6: Self Powered : 0x00 (no)
D5: Remote Wakeup : 0x00 (no)
D4..0: Reserved, set 0 : 0x00
MaxPower : 0x00 (0 mA)
Data (HexDump) : 09 02 20 00 01 01 00 80 00 09 04 00 00 02 FF 00 .. .............
00 00 07 05 81 02 40 00 00 07 05 02 02 40 00 00 ......@......@..
---------------- Interface Descriptor -----------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x00 (Interface 0)
bAlternateSetting : 0x00
bNumEndpoints : 0x02 (2 Endpoints)
bInterfaceClass : 0xFF (Vendor Specific)
bInterfaceSubClass : 0x00
bInterfaceProtocol : 0x00
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 00 00 02 FF 00 00 00 .........
----------------- Endpoint Descriptor -----------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x81 (Direction=IN EndpointID=1)
bmAttributes : 0x02 (TransferType=Bulk)
wMaxPacketSize : 0x0040 (64 bytes)
bInterval : 0x00 (ignored)
Data (HexDump) : 07 05 81 02 40 00 00 ....@..
----------------- Endpoint Descriptor -----------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x02 (Direction=OUT EndpointID=2)
bmAttributes : 0x02 (TransferType=Bulk)
wMaxPacketSize : 0x0040 (64 bytes)
bInterval : 0x00 (ignored)
Data (HexDump) : 07 05 02 02 40 00 00 ....@..
-------------------- String Descriptors -------------------
------ String Descriptor 0 ------
bLength : 0x04 (4 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language ID[0] : 0x0409 (English - United States)
Data (HexDump) : 04 03 09 04 ....
------ String Descriptor 1 ------
bLength : 0x0C (12 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language 0x0409 : "OXHOO"
Data (HexDump) : 0C 03 4F 00 58 00 48 00 4F 00 4F 00 ..O.X.H.O.O.
------ String Descriptor 2 ------
bLength : 0x0A (10 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language 0x0409 : "TP90"
Data (HexDump) : 0A 03 54 00 50 00 39 00 30 00 ..T.P.9.0.
------ String Descriptor 3 ------
bLength : 0x1E (30 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language 0x0409 : "TP900021190243"
Data (HexDump) : 1E 03 54 00 50 00 39 00 30 00 30 00 30 00 32 00 ..T.P.9.0.0.0.2.
31 00 31 00 39 00 30 00 32 00 34 00 33 00 1.1.9.0.2.4.3.