machdyne / blaustahl

Blaustahl Storage Device
Other
57 stars 8 forks source link

Automatic launch of built-in application on device when connected to a computer #11

Open binqbit opened 1 month ago

binqbit commented 1 month ago

Hello,

I have a question regarding the potential use of the Machdyne Blaustahl Storage Device. Is it possible to modify the driver or reflash the flash drive so that when the device is connected to a computer, it automatically detects the operating system and launches the corresponding pre-installed program?

Currently, I have developed a special application for this device — password manager (svpi). Manually installing and launching the application each time the device is connected seems inconvenient. I aim for the password manager to launch automatically when the device is connected to any computer.

I would be extremely grateful for any assistance or advice on this matter.

machdyne commented 1 month ago

On Linux I think you can set up a udev rule to launch a program when a device is connected. On old versions of Windows you could use an autorun.inf file (assuming a USB-MSC device was added) to launch a program when the device is connected, but getting that to work would probably require a custom driver.

I don't think there's a generic way to do this on the device itself, it would have to be set up on the OS.

binqbit commented 3 weeks ago

I wanted to specify that in standard USB devices, it's indeed possible to use an autorun.inf file to specify which program should launch upon connection. However, the Machdyne Blaustahl Storage Device is a specific device, and as I understand it, this approach isn't applicable.

I'm interested in how to organize the automatic launch of a program specifically on this device. Is there a possibility of creating a custom driver or modifying the firmware to implement this feature?

machdyne commented 3 weeks ago

If autorun.inf would solve your problem, you might try modifying the composite firmware and adding a MSC interface.

Here's an example for emulating a FAT-formatted drive in order to serve a read-only file:

https://github.com/hathach/tinyusb/tree/master/examples/device/cdc_msc

Keep in mind though that the composite firmware isn't currently recognized by Windows, so you'd need to solve that problem also, which may require creating a custom driver in order to get the composite device recognized. I don't know much about Windows drivers.

I guess some distros of Linux may also support autorun files, so you could use the same concept there with MSC. But the udev solution would probably be much simpler on Linux.