cancel
Showing results for 
Search instead for 
Did you mean: 

Password for USB Device

Nico3
Senior

I am using STM32F4 MCU in USB device MSC mode with data stored on SD card. I have also standard 16X2 LCD & Membrane keypad connected to MCU 

I want to make interface where once USB device is connected to laptop, the data is showed on laptop after entering PIN on LCD.

Please suggest where in USB device code, I can put my loop for my pin entering.  

3 REPLIES 3

Probably not in a loop that blocks.

Have it in it's own task or sub-thread, have it set a volatile variable or send a signal, and have that respond to the OS querying the device with a TEST UNIT READY request, with a sense code that the device is ready, and that's there's been a change in media. The PC will then re-enumerate the content.

Have the MSC report it has Removable Media, in the device query.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Pavel A.
Evangelist III

Have the MSC report it has Removable Media, in the device query.

There are other options as well... many USB disks are not Removable Media. Instead you can hide the whole MSC function until the password is entered.

 

 

Yes, probably.

If Removable Windows will Provide an Eject option you can Lock the media with. Also won't use NTFS on it.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..