Hi
Our system has a USB device port and SD card slot, the SD card is optional, so there are 2 cases:
1. Connect the USB to PC, it needs to be a HID device. 2. Insert SD card, then connect USB to PC, it needs to be a HID+MSC composite device.
I am using RL_USB, this means I need 2 usb configuration: one for single HID device, the other for composite HID+MSC device, firmware needs to detect if sd card is inserted to decide which configuration to enable. However, it seems I can only config the usb class in compile time, and not able to change it in runtime??
Am I right? What's the general solution for this requirement? I am using RL_USB library.
Thanks.
You may always expose HID + MSC configuration to host. The MSC interface returns NOT READY - MEDIUM NOT PRESENT sense data while no SD card is inserted. I believe Keil SD reader example implements this response.
Tsuneo
In this way (use CheckMedia), if sd card not inserted, windows still display an disk icon "Removable Disk", if you double click the disk, you get a message: please insert a disk into drive.
What I would like is that windows DO NOT display that disk icon until sd card is inserted! is this possible?
PS: My home pc has a built-in sd slot, windows always display "Removable Disk" icon, no matter sd card is present or not.
If I use a USB-SD converter, connect the usb to pc, windows always display "Removable Disk" icon, no matter sd card is present or not.
Don't know if this is the general solution.
If you get your device to disconnect and reconnect, you cn have it enumerate as a disk only when it has a SD card inserted.
View all questions in Keil forum