I have been working with MTP_Teensy implemented on a Teensy 4.1 with the intent of integrating it into a datalogger. I have been trying to solve the problem of programmatically resetting the session from Windows host so as to be able to view the newly-logged files in File Explorer-like view.
Following the recommendation at https://github.com/KurtE/MTP_Teensy, I can successfully accomplish the disk content refresh in Win10 DeviceManager--Disable device followed by Enable device shows the refreshed list of files in the File Explorer-like view.
So far so good, but I want to do the disable/enable from my Win10 C# application followed by a redisplay of the files list. The PnPUtil application found on every Win10 PC is designed to do this. First I can find the MTP_Teensy device and obtain its instance id:
Then I should be able to disable the device by instance id with PnPUtil, but the command fails, apparently because the device is not connected:
Of course a search reveals that this PnPUtil enable/disable command always "just works" and I cannot find any help on the "device is not connected" error.
This Disconnected status persists even when I am interacting with the device in Win10, and also when my C# app has an active connection to it. In my C# app I am using the MediaDevices NuGet package which is able to connect and interact with the Teensy MTP device.
Is there something about the MTP_Teensy implementation that fails to report the status as Connected? Perhaps I am mis-understanding what's happening here, but it would be nice if I could refresh the MTP_Teensy files list programmatically. (I can workaround by rebooting the Teensy from my host app to refresh, but I would rather not do that.)
Thanks,
John
Following the recommendation at https://github.com/KurtE/MTP_Teensy, I can successfully accomplish the disk content refresh in Win10 DeviceManager--Disable device followed by Enable device shows the refreshed list of files in the File Explorer-like view.
So far so good, but I want to do the disable/enable from my Win10 C# application followed by a redisplay of the files list. The PnPUtil application found on every Win10 PC is designed to do this. First I can find the MTP_Teensy device and obtain its instance id:
Code:
C:\WINDOWS\system32>pnputil /enum-devices /instanceid "USB\VID_16C0&PID_04D1&MI_01\a&12108765&1&0001"
Microsoft PnP Utility
Instance ID: USB\VID_16C0&PID_04D1&MI_01\a&12108765&1&0001
Device Description: Teensy
Class Name: WPD
Class GUID: {eec5ad98-8080-425f-922a-dabf3de3f69a}
Manufacturer Name: PJRC
Status: Disconnected
Driver Name: wpdmtp.inf
Then I should be able to disable the device by instance id with PnPUtil, but the command fails, apparently because the device is not connected:
Code:
C:\WINDOWS\system32>pnputil /disable-device "USB\VID_16C0&PID_04D1&MI_01\a&12108765&1&0001"
Microsoft PnP Utility
Failed to disable device: USB\VID_16C0&PID_04D1&MI_01\a&12108765&1&0001
The device is not connected.
Of course a search reveals that this PnPUtil enable/disable command always "just works" and I cannot find any help on the "device is not connected" error.
This Disconnected status persists even when I am interacting with the device in Win10, and also when my C# app has an active connection to it. In my C# app I am using the MediaDevices NuGet package which is able to connect and interact with the Teensy MTP device.
Is there something about the MTP_Teensy implementation that fails to report the status as Connected? Perhaps I am mis-understanding what's happening here, but it would be nice if I could refresh the MTP_Teensy files list programmatically. (I can workaround by rebooting the Teensy from my host app to refresh, but I would rather not do that.)
Thanks,
John