This debugging was done on behalf of a client who has a USB peripheral, based slightly on the Cypress Semiconductor CY4601 reference design. (See a previous post for our connection to this product.) In this application, our USB-Serial WDM driver is known as HIDCOM.SYS.
The client's product is a big piece of machinery, with a USB interface for connection to a Windows PC. Their device is configured so that it appears to be three USB peripherals:
- An imaging device, which loads the Windows USBSCAN.SYS driver.
- A first serial port, which is attached to a smartcard reader built into the machine. This uses our HIDCOM.SYS driver.
- A second serial port, which is used for control functions within the machine. This also uses HIDCOM.SYS.
So, it's quite complicated already, but onto this lot, we add the following:
SERENUM.SYS - this is the MS-provided serial device enumeration driver. It loads as an upper filter on to serial port drivers, and is responsible for detecting PnP-compliant serial devices which are connected, and then loading drivers for them. Both HIDCOM devices have SERENUM layered on top by the HIDCOM.INF file.
CARD.SYS - In this application the smartcard reader was PnP compliant, so SERNUM would load another driver on top of one of the HIDCOM devices - we'll call this CARD.SYS. It's written by the manufacturer of the smartcard reader.
So, quite a stack, and unusual (c.f. other HIDCOM applications) in having a KM driver talking to us rather than a user mode application.
The problem the client had was that when they unplugged the device, their devices would NOT disappear from Device Manager. In fact, Device Manager would no longer do anything without hanging. USB devices were not recognised when connected or disconnected. The only option at that point was to reboot the PC.
The discovered that if they went to Device Manager and disabled the smartcard device BEFORE unplugging, then everything was OK.
I'll describe the start of the investigation in another post.