Teensy with SD Card

Status
Not open for further replies.
Hello,

I'm currently planing the following project:

I want a device with storage in it, on the storage there is a .exe-file and lots of free space. When I plug it in, the .exe should be executed and the .exe will write on the free space.

To get more precise, I'm planning to use a teensy and put a sd card adapter on it, put in a sd-card, put the .exe on the sd card, and program the Teensy to open cmd, move to the sd-card path, open the exe and print a success prompt when finished.

Little Edit: Didn't play around with Teensy for some time, I see it right, that Teensy 3.6 has the SD-Card capability on board already? Anyway, same question, if thats working..

If that's possible I'd have a few questions on this but first, I wanted to ask, if I'm on the right path or if that's not possible. Didn't find an example, where the user in front of the computer plugged in the teensy and just accessed files on explorer, is that even possible?

If that's not possible, would it be an alternative to use 3 parts for the project: a teensy, a usb hub and a normal usb mass storage, but the teensy and the mass storage on the hub and just access the mass storage then? If yes, could I guarantee the mass storage to always get the same drive letter? (otherwise I can't switch to it in the console, can I)?

Thanks for the help in advance.

Kind regards,
nameless__
 
Last edited:
A Teensy is an embedded processor. It does not support having programs on SD cards and executing them. You program a Teensy by downloading the program into the read only memory. When it powers on, it executes the program in memory. It may write to a SD drive or not.

Also at present, there is no easily used mass storage interface so that either the Teensy could act like a removable USB drive or use a removable USB drive that is plugged it. You can program a Teensy to act like certain USB devices when plugged in, but I believe that mass storage is not one of the current options without writing a lot of the software.

Also whether a random USB device will work when plugged into a normal computer/laptop depends on what operating system the computer is running, and what security settings are used.

There might be ways to do it with a Teensy, but I suspect it is not off the shelf, and you will need to implement such things.
 
But won't the mass storage think be working (if the usb device is working) when I use a hub? Imagine plugging in a usb stick in a computer, then plugging in a teensy which has the code on it to press windows + r, enter cmd, type "cd h:/program" and then type "program.exe" or something? shouldn't that be working for sure (as fallback)?
 
But won't the mass storage think be working (if the usb device is working) when I use a hub? Imagine plugging in a usb stick in a computer, then plugging in a teensy which has the code on it to press windows + r, enter cmd, type "cd h:/program" and then type "program.exe" or something? shouldn't that be working for sure (as fallback)?

That would work, in theory. In practice, you'll never know which drive letter gets assigned to your stick.

What are you trying to do? Sounds like some kind of hacker tool to me ;)
 
you'll never know which drive letter gets assigned to your stick.
Isn't there maybe a way to do something like "change to mass storage that is connected to the same hub as I am"? If you know what I mean? Or is there a way I can force a drive letter? If I could, how is this on Ubuntu?

What are you trying to do? Sounds like some kind of hacker tool to me ;)
It kinda is, its a forensic tool, which will save some information, e.g. read the ram of the computer plugged in and save it to the mass storage then. Goal would be to automize the process, so you only need to plugin the teensy (or teensy, hub, usb stick combination), whatever, and everything is done itself, instead of the need to do everything by hand.
 
A Teensy is an embedded processor. It does not support having programs on SD cards and executing them. You program a Teensy by downloading the program into the read only memory.

Also would like to get back to this answer: I don't want to really teensy "directly executing" the program, so I don't want to load it in memory. Instead I would only need the teensy to do what I said, like:

Windows+r
cmd
cd C:/test
program.exe

Thats alle the Teensy itself would need to execute, I only would have the same problem as with the USB-Hub solution (don't know which drive letter) and I'm not sure, how the sd-card is mounted, so if its even possible, to plug in the Teensy and load data on it for example. If not, what would an SD-card be good for?
 
Also would like to get back to this answer: I don't want to really teensy "directly executing" the program, so I don't want to load it in memory. Instead I would only need the teensy to do what I said, like:

Windows+r
cmd
cd C:/test
program.exe

Thats alle the Teensy itself would need to execute, I only would have the same problem as with the USB-Hub solution (don't know which drive letter) and I'm not sure, how the sd-card is mounted, so if its even possible, to plug in the Teensy and load data on it for example. If not, what would an SD-card be good for?

Well the Teensy can act as a USB keyboard and/or mouse. I imagine you can have a Teensy send the appropriate commands to start up a HID device to do communication with the Teensy (the Teensy can act as multiple USB devices, but right now, it can't act like a removable disk). That assumes you have programs stored on the PC that the Teensy can execute.

From the few times I've played with the USB mouse, I would suggest having a button on the Teensy that disables the keyboard/mouse so that you can more easily reprogram it.
 
I imagine you can have a Teensy send the appropriate commands to start up a HID device to do communication with the Teensy [...] That assumes you have programs stored on the PC that the Teensy can execute.

Does it really have to be stored on the PC, thats the question...? Could I not store these programs on the sd card i plug into thea teensy? Then it would be the perfect thing because the other thing is exactly what I was thinking of, so the Teensy acts as keyboard, opens up a shell and executes the program, the question only is, if this program can be stored on a sd card in the Teensy as well or if it has to be something external?t
 
Does it really have to be stored on the PC, thats the question...? Could I not store these programs on the sd card i plug into thea teensy? Then it would be the perfect thing because the other thing is exactly what I was thinking of, so the Teensy acts as keyboard, opens up a shell and executes the program, the question only is, if this program can be stored on a sd card in the Teensy as well or if it has to be something external?t

Sure, if you implement the Teensy mass storage driver which is currently not implemented. It is likely to be a long process. But that is the way of open source, it might not be there now, but if you roll up your sleeves, you can possibly add the missing functionality. If you wait for Paul to implement it, it may be a long wait.

With the current Teensy, you cannot execute programs on the SD card. You can only program the flash memory via USB. Various people have worked on various methods to load Teensys in the field (which is a variant of loading a program from a SD card), but they are not in the default distribution, and they likely have a number of gotchas.
 
Last edited:
Well, okay, to be honest I'm not sure if I have this skills to do it... How do you think about the other possibility with the USB-Hub? Do you think that this would be possible somehow?
 
Would it be possible to load the executable from the net? This is what they do here: https://www.nixu.com/blog/hidden-gem-low-cost-digispark-usb-now-quacks-duckyscript

But it just occurred to me that you don't have to know the location of the stick. Just keep trying D:\myexefile.exe ; E:\myexefile.exe ; F:\myexefile.exe ; etc. Once your executable is running it can easily determine its location if needed.

The same goes for Ubuntu, provided auto-mount for USB devices has not been disabled.
 
Would it be possible to load the executable from the net? This is what they do here: https://www.nixu.com/blog/hidden-gem-low-cost-digispark-usb-now-quacks-duckyscript
Unfortunately thats not possible, no... Its a tool, just for internal use...

But it just occurred to me that you don't have to know the location of the stick. Just keep trying D:\myexefile.exe ; E:\myexefile.exe ; F:\myexefile.exe ; etc. Once your executable is running it can easily determine its location if needed.

The same goes for Ubuntu, provided auto-mount for USB devices has not been disabled.

That's exactly what I was not sure about when I go for the usb-mass-storage solution as well, how can I know which drive letter it is. But you're right, I might be able to just try it for every letter and once it starts, stop trying, that's a idea I should consider.
 
Status
Not open for further replies.
Back
Top