reuse winusb driver PID

I am developing a board using winusb to communicate with PC.
If I program with a PID and it fails, after I modify the program with the same PID, windows always reports error.
Windows does not even issue the request value code 0x3EE.
How can I delete the PID compeletely from my computer in orde to reuse it?
My OS is windows10, 64bit.

Thanks

“If I program with a PID and it fails” … “Windows always reports error” … Do you really think that’s an adequate description of your problem? You’ve given us absolutely nothing here. We need details.

Is it a vendor-class device, or is it some standard device? When you say “program”, do you mean programming the device, or do you mean your Windows application? What fails? What error do you get, exactly, and from which API?

Are you changing the descriptors? If you have the same interfaces every time, then you don’t have to do anything to reuse the PID. If you change from a composite device to a non-composite device, that can be an issue, but we’ll address that later.

Dear Tim
Thank you for your response.
We are developing a CDC class device. And we think it is a vendor-class. But it is very simple. We just use it to send and receive some data.
The device and configuration descriptor file is attached.
“program” means making the source code of the device.
Because the device is being developed, its source code is being modified and modified.
When the source code is not perfect, windows cannot install the driver. Let the PID be A.
But even when its source code is modified, I uninstalled the driver of PID A in windows, and driver can be installed with PID B,
windows always tell me “The driver cannot be installed” and the error code is 28 if the PID A is used in the source code when I connect the usb device to computer. That means some information reside in the computer yet when its driver is uninstalled.
I want to delete clearly the all information of the device with PID A if its driver fails to be installed, in order to install a new device with PID A.
Can you tell me how to do it?
Thanks.

Still not adequate problem description. There is something strange. CDC class devices don’t use WinUsb driver, they use USB to serial driver which should be automatically installed on Win10 for device with proper descriptors (I haven’t checked your thoroughly).

However, you mention 0x3EE request, which looks like an attempt to read MS OS descriptors (and in turn install WinUsb automagically). In such a case it can be really necessary to make a cleanup after an unsuccessful attempt because OS stores part of the info permanently after the first even partially successful attempt. I’m developing such a devices but I did this part many months before and forgot exact details. Try following:

  • uninstall driver in the Device Manager and enable deleting driver binaries
  • go to the registry and delete HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_XXXX&PID_XXXX\YYYY node for your device (you need to find the exact node, there can be more)
  • delete HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\your_VIDyour_PID??? key (osvc value may be sufficient).

I guess the last one is what you need but experiment is on you (also, it is documented in MS OS descriptions docs). Usually warnings about registry editation apply but I guess it is obvious in driver development list :slight_smile:

1 Like

Dear Michal

Thank you for your kind and considerate help.
First, you told me how to make a cleanup. I did as you told me and It works well.
Second, you told me CDC class device uses USB to serial driver. It is a mistake of me.
I want to develope a device with just one data class interface and three endpoinds (a interrupt endpoint for control, a bulk in and a bulk out endpoint for send/receive data).
Which class device should I use?

Thanks a lot.

Which class device should I use?

This is a question you have to answer yourself. I have no idea what device are you using, what libraries are available, what communication protocol you want to use etc. Typically the easiest solution is to use some existing USB class implementation which is part of the SDK for your device.

At Windows there are two basic choices for a custom device. CDC ACM class with built-in USB to serial driver (Win10) and the device using MS OS descriptors to install WinUsb driver automatically. The latter is a bit more complicated as you have to implement the decriptors and protocol correctly but I prefer it as it gives a bit more freedom and options. Also, WinUsb driver is stable and functional whereas USB to serial driver is rewritten in Win10 which was really necessary but unfortunately there are new bugs at some Win10 releases (don’t know current state as we abandoned it).

If it is a “CDC class” device, then it is not a “vendor class” device. The class comes from the device descriptor. If you’re using one of the standard device classes, then it’s not vendor class.

If your device adheres to the CDC class specification, then you don’t have to write a driver. That’s the whole point of having USB class specifications: Microsoft writes one class driver, and ALL devices that meet the class spec can be handled by that driver.

If you want to do your own custom data transfers, which is a perfectly valid thing to do, then you can set the class in the device descriptor to 0xFF. When you do that, Windows will not attempt to assign a driver automatically. You can then use an INF file or the Microsoft OS Extended descriptors to assign WinUSB, and you can do whatever you want.

1 Like

Dear Tim

Thank you very much for your help.
I am not so familiar with usb communication. I do not know even what should be set in the configuration descriptor. I want to use winusb and the data class interface. I have no intention to develop a driver and write an INF file. I do not want my usb device look as a virtual serial port. A 12Mbps speed of bulk in and out is desired. I wrote a configuration descriptor, but I have no confidence if it is compliant to the standard cdc class specification. It is the reason I said it was a vendor class.
Could you have a look of my configuration descriptor?
If you can tell me what is wrong and give me a correct sample, I would appreciate your help much more.
The device is working “normally”. I can send and receive data. But windows tells me “device not migrated”. A status code 0xC0000719 and a migration flag 0xF000FFFFFFFF0023 are listed. I do not know what I can do to fix this. I think there must be something wrong in my descriptor. Can you give me some advice?

Thanks a lot.

If you are not planning to use a standard system driver, then do not use any of the standard device classes. Just make it a custom vendor-class device. When you advertise a standard device class, you are promising to adhere to the class spec, but there’s no reason to go to that trouble if you’re not going to use a standard driver. You can do whatever is most convenient for your purposes.

I can look over your descriptor, if you wish. I just need to know where to find it. What USB chip are you using?

I thought the “device not migrated” error was due to a problem in the INF. Do you have an INF at all? If the device is working, the web seems to imply you can ignore that error.

Dear Tim

Thank you very much.
I use RZ/A1H R7S721000VCFP, and do not use any INF file. The OS is windows10.
Winusb can work without customized INF file on windows10.
I had posted the descriptor here
/uploads/db2714/original/1X/8c73ee0d5fcc743da827e29b2c096f637bc0031a.txt
I would like to use a standard device class.

Yours sincerely

So this is Renesas? I’m not familiar with your device but I’m using other ones from them. They have predefined USB classes and one of them is CDC ACM class. You don’t have to define descriptors, just to use their horrible configurator and this class. I’m using their e2studio + SSP and this is possible and recomended there (well, I wrote my own class but not because I had to).

Winusb can work without customized INF file on windows10.

No, it can’t, unless the device has the Microsoft extended OS string descriptors. Somehow, some way, someone has to assign the WinUSB.sys driver to your device. That has to be done by an INF. It’s either your custom INF, or the vendor’s custom INF, or the Microsoft INF that matches the string descriptors.

I would like to use a standard device class.

Why? What do you gain?

However, if it’s working, then your problems are solved, right?

Dear Michal

Thank you very much for your advice.
I do not desire my device looking like a virtual port. I need more speed. And I want just the data class interface. I modified it.
If it can not work properly, I would have to use the CDC ACM class.
Anyway, thanks.

Dear Tim

Thank you very much for your help.
I define the extended OS string descriptor in my firmware.
Windows can read it.
For windows10, WinUSB.sys driver can be used to my device without the INF defined by me. I use a standard device class to avoid developing a new driver for my device.
https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/automatic-installation-of-winusb
My device is working well except a warning of “Device not migrated” in the event list.
I had better have more test. I may ignore it. If I can find a method to fix it, there would be nothing better.
Yours sincerely.

I do not desire my device looking like a virtual port. I need more speed.

You still have some fundamental misunderstandings about USB. A “virtual serial port” does not have any inherent speed limitations. It will run at whatever data rate the hardware can sustain. For a full-speed device, you can do about 8 Mbps.

And I just want the data class interface. I modified it.

If your device does not fully meed the CDC specification, then it violates the protocol for you to advertise in that class. Since you have the extended OS descriptors, you can change it to a vendor device class and everything will work just fine.

1 Like

Dear Tim

Thank you.
You told me you would have a look over my descriptor.
Could you give me some specific advice ?

Yous sincerely