Tips on how to remove remembered devices from Windows, particularly handy when changing a Teensy device name in usb_desc.h

This is less of a question and more of a comment in case someone else finds it helpful..
But if like me you've modified the usb_desc.h file to change the name of a device or you've changed something in the usb.desc.c file, but Windows isn't reflecting the changes because it 'remembers' the device, here are a few pointers to help Windows forget. If you encounter this situation I'd recommend disconnecting the device and following all of the steps below for the belt and braces approach. Changing the devices' VID and/or PID/BCD also let's Windows think the USB device is 'new', but that workaround has its own pros and cons.

1) Use the USBDeview tool to remove the device(s) in question.
This handy little tool lets you view all the USB devices that are and have been connected to your Windows device and allows you to uninstall them. It's freeware and runs as a standalone utility, no install required.
https://www.nirsoft.net/utils/usb_devices_view.html

usbdeview.jpg


2) Remove the relevant device(s) from Windows Device Manager.
Even when a device is no longer conencted to your computer it will remain in Device Manager as a hidden device. Select the View menu tab and enable Show hidden devices to reveal those devices that Windows still thinks are there.

device_manager_hidden.jpg


3) Windows Registry will also remember your device. Browse to the following registry key and delete the appropriate keys as necessary: HKEY_CURRENT_USER\System\CurrentControlSet\Control\MediaProperties
Look for anything that contains the vendor ID used by Teensy, which in this case is 16C0. Sometimes it's worth searching the entire registry hive for VID_16C0 to find any other traces that are hidden away.
**Always apply caution when modifying the registry as deleting or modifying the wrong thing can have negative consequences. You make registry changes at your own risk**

registry.jpg


And finally.. I've also had issues where the Arduino IDE is caching certain core / library files when compiling, and thereby not reflecting the recent changes that I've made. In some instances I had to workaround this issue by clearing Arduino's cache. Launching the Arduino IDE application using the '--clean' switch seemed to work for me, emptying the Temp folder in the user's profile folder seems to help too.

To run the Arduino IDE with the '--clean' switch you can open a command prompt and navigate to your Arduino IDE install folder, this will typically be one of the following:
C:\Program Files\Arduino IDE\
C:\Program Files(x86)\Arduino IDE\
or
C:\Users\username\AppData\Local\Programs\Arduino IDE\

Then run the command:
"Arduino IDE" --clean
the quotation marks are required as the .exe file contains a space in its name

The Temp folder can be found here:
C:\Users\username\AppData\Local\Temp\
Note that if you empty this, be sure to only delete the contents and not the folder itself, you will no doubt encounter files that cannot be deleted because they are currently open, just skip these **Again, you do this at your own risk**
 
Last edited:
Thanks for your tips. USBDeview turned out to be a useful tool on several occasions.
or
C:\Users\username\AppData\Arduino IDE\
I think that should be C:\Users\username\AppData\Local\Programs\Arduino IDE\ [at least, that's where I found it running Windows 11]

Paul
 
I'm a bit puzzled about what "Arduino IDE" --clean is actually doing.
When I start Arduino 2.3.2, open the example "Blink" sketch for Teensy 4.0 and compile it by clicking the 'Verify' button, I see all files being generated from scratch (no cached or pre-compiled stuff in the verbose window). When I again compile that same sketch, I now see "Using precompiled core:" stuff in the verbose window. Allright, that seems valid. I close the Arduino 2.3.2 IDE.
Now when I run the "Arduino IDE" --clean command from the command prompt, the Arduino IDE is opened with a different, older sketch!? Also the command prompt does not return; "Arduino IDE" --clean is still running.
Closing the Arduino IDE and pressing Enter in the command windows returns the command prompt.
Now when I reopen the Arduino IDE, open the Blink sketch and compile it, I again see the "Using precompiled core:" stuff in the verbose window.

So I'm not sure what "Arduino IDE" --clean is doing...
I also checked the C:\Users\Paul\AppData\Local\Temp\ folder but it is not emptied.

Does someone know what this "Arduino IDE" --clean command is doing and what it is intended for?

Paul
 
This is less of a question and more of a comment in case someone else finds it helpful..
But if like me you've modified the usb_desc.h file to change the name of a device or you've changed something in the usb.desc.c file, but Windows isn't reflecting the changes because it 'remembers' the device, here are a few pointers to help Windows forget. If you encounter this situation I'd recommend disconnecting the device and following all of the steps below for the belt and braces approach. Changing the devices' VID and/or PID/BCD also let's Windows think the USB device is 'new', but that workaround has its own pros and cons.

1) Use the USBDeview tool to remove the device(s) in question.
This handy little tool lets you view all the USB devices that are and have been connected to your Windows device and allows you to uninstall them. It's freeware and runs as a standalone utility, no install required.
https://www.nirsoft.net/utils/usb_devices_view.html

View attachment 34308

2) Remove the relevant device(s) from Windows Device Manager.
Even when a device is no longer conencted to your computer it will remain in Device Manager as a hidden device. Select the View menu tab and enable Show hidden devices to reveal those devices that Windows still thinks are there.

View attachment 34309

3) Windows Registry will also remember your device. Browse to the following registry key and delete the appropriate keys as necessary: HKEY_CURRENT_USER\System\CurrentControlSet\Control\MediaProperties
Look for anything that contains the vendor ID used by Teensy, which in this case is 16C0. Sometimes it's worth searching the entire registry hive for VID_16C0 to find any other traces that are hidden away.
**Always apply caution when modifying the registry as deleting or modifying the wrong thing can have negative consequences. You make registry changes at your own risk**

View attachment 34310

And finally.. I've also had issues where the Arduino IDE is caching certain core / library files when compiling, and thereby not reflecting the recent changes that I've made. In some instances I had to workaround this issue by clearing Arduino's cache. Launching the Arduino IDE application using the '--clean' switch seemed to work for me, emptying the Temp folder in the user's profile folder seems to help too.

To run the Arduino IDE with the '--clean' switch you can open a command prompt and navigate to your Arduino IDE install folder, this will typically be one of the following:
C:\Program Files\Arduino IDE\
C:\Program Files(x86)\Arduino IDE\
or
C:\Users\username\AppData\Local\Programs\Arduino IDE\

Then run the command:
"Arduino IDE" --clean
the quotation marks are required as the .exe file contains a space in its name

The Temp folder can be found here:
C:\Users\username\AppData\Local\Temp\
Note that if you empty this, be sure to only delete the contents and not the folder itself, you will no doubt encounter files that cannot be deleted because they are currently open, just skip these **Again, you do this at your own risk**
I've been using a Windows App called Device Cleanup. It will find all the unconnected devices and allow you to remove them.
 
Back
Top