I want to make a device for USB which is connected through usb to PC and offers an usb port. The device should have a button which ejects (in Windows) the device plugged at the port of the device.

After some research... First I wanted to solve this problem through a C# program- but I really have no idea how to access through C# on "my button". (the project's code isn't available anymore-if you know where I could get it-I would be really really happy.)

So I did some more research... now I plan to use the WinAPI in combination with some C to accomplish this...(writing a device driver using the KMPF(Kernel module of windows).

→But: I'm completly new to this.

How should I start?

Any suggestions/links which microcontroller would be good for this?

Is it possible to use the WinAPI (KMPF) to access on hardware input/my device's button?


closed as unclear what you're asking by Matt Young, PeterJ, Daniel Grillo, Dave Tweed Jul 5 '15 at 20:19

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ If you could call windows APIs from a USB device, merely plugging in any USB device would give you instant access to everything on the computer. You will need a program running on the computer for this to work; in which event, why do you want a physical device at all? \$\endgroup\$ – Nick Johnson Jun 30 '15 at 14:32
  • \$\begingroup\$ well- I want a physical device because it would make it easier, faster and more comfortable to remove an usb device "safe" \$\endgroup\$ – leAthlon Jun 30 '15 at 14:43
  • \$\begingroup\$ In that case, look for any of a large number of "usb single button keyboard" projects, replicate that, then make your Windows app bind to the key combination your "keyboard" emits. \$\endgroup\$ – Nick Johnson Jun 30 '15 at 14:45
  • \$\begingroup\$ By "button" you mean a software button? \$\endgroup\$ – Eugene Sh. Jun 30 '15 at 14:45
  • 1
    \$\begingroup\$ Are you saying you want a hub that can be commanded using a software button in Windows to disconnect any devices plugged into it? \$\endgroup\$ – Jon Jun 30 '15 at 15:51

A MCU with USB interface can be chosen. The button will be a interrupt to the MCU. The MCU will be connected to the PC as a slave. Whenever the user presses the button (which is interfaced to the MCU) the associated firmware can raise a request to the application running on PC. The application later can handle the USB safe removal process.

This involves both hardware and software design and hence might not be efficient for quick prototype.

  • \$\begingroup\$ can you give an example for a good MCU? \$\endgroup\$ – leAthlon Jun 30 '15 at 20:20
  • \$\begingroup\$ @leAthlon That is subjective. STM32 series have a few USB ones. And ofcourse many from other vendors too. Full requirements should help in selecting a final MCU. I would personally go for one which had broad user community and rich software driver availability \$\endgroup\$ – Umar Jul 1 '15 at 0:51
  • \$\begingroup\$ @leAthlon STM32F4DISCOVERY board can be used. I believe you are okay with firmware that has to be developed on PC side \$\endgroup\$ – Umar Jul 1 '15 at 3:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.