How to receive serial data from Teensy when it is configured as Disk+Keyboard?

Status
Not open for further replies.

liuhuan

Member
Dear friends,

I have configured Teensy's USB type to be Disk (SD card) + Keyboard. I hope to receive the serial data from Teensy. Although there is no USB type of Disk+Serial, I think this is possible because in Serial Monitor, I am able to see the messages.

Under linux, my dmesg shows that Teensy is being recognized as Teensy Disk/Keyboard. No serial is mentioned. I have tried minicom on ttyS0 with no success.

I have the following questions and wonder if you can help me:

1, Is this actually possible? If possible in Teensyduino or C, could you give me some rough guidelines? If not, what would you recommend me to do to allow Teensy communicate back to the PC in the way SerialMonitor works?

2, What port is Teensy recognized as under Linux? I looked at the preferences.txt, it says serial.port=COM1, which only makes sense in the context of Windows.

Thanks for your help!

Huan
 
Last edited:
For the non-serial USB types, a serial-like channel is emulated with HID. It's not serial at all, but HID.

The "teensy_gateway" program runs in the background, listening for HID data from the Teensy and making it available via localhost networking, at 127.0.0.1:28541. You can connect to it with telnet. Use "telnet 127.0.0.1 28541". Teensyduino patches the serial monitor to connect to 127.0.0.1:28541 when used in this mode.

So your easiest path would be using localhost networking to connect to the teensy_gateway program.

A much more difficult path would be trying to splice the USB Disk and USB Serial code together. That might be possible, but it's not easy to edit the USB code.
 
The teensy_gateway program is very sweet indeed. Is it opensource? Is its source included in teensyduino? I'd love to learn more about how it works!
 
I have a similar question:
I'm using a Teensy 2.0 in 'keyboard' mode & I want to send configuration data from my PC to the Teensy.
The ideal way to do this would be to use 'disk(internal) + keyboard' and save the configuration data on the internal disk but unfortunately this will only work at compile time as the internal disk is read only from the PC on Teensy 2.0.
Telnet would be an option but it doesn't seem to work bi-directionally, or at least not with Serial.read() on the Teensy side.
 
done that

That should work. First, try sending with the Arduino Serial Monitor.

I'm using putty on a W7 machine (no native telnet)
I receive ok but Teensy seems deaf. I've also tried connecting via a browser (firefox) - I can dump data to the browser but my app doesn't see the http GET
 
Hi

I pretty new to teensy world. But is it not possible simply to connect to the uart port ?

Sasha,

I think Paul summed this up. My application is a USB data logger of sorts - it plugs in via USB and dumps data as if it were a keyboard, however I want the user to have control of certain parameters.
 
Just the same as putty. Teensy transmits but doesn't receive.
Oops - I lied! It does work! I'm not sure what I was doing wrong with putty...
However, this still isn't ideal as it requires the end user to have the Teensy gateway.
 
Last edited:
Just the same as putty. Teensy transmits but doesn't receive.
Oops - I lied! It does work! I'm not sure what I was doing wrong with putty...
However, this still isn't ideal as it requires the end user to have the Teensy gateway.

Hi guys,

I'm having the same problem as Ian described earlier: I can receive data from Teensy, but cannot send via the socket. I tried to use the telnet program in Ubuntu and use the python socket library, both could receive fine, but none of the data could be received by teensy.

The IP and port I used are: 127.0.0.1 and 28541.

The USB mode is: SD card + keyboard.

Any idea? Maybe there's some subtle difference between the telnet implementation in windows and others?

Thanks!
 
Last edited:
For the non-serial USB types, a serial-like channel is emulated with HID. It's not serial at all, but HID.

The "teensy_gateway" program runs in the background, listening for HID data from the Teensy and making it available via localhost networking, at 127.0.0.1:28541. You can connect to it with telnet. Use "telnet 127.0.0.1 28541". Teensyduino patches the serial monitor to connect to 127.0.0.1:28541 when used in this mode.

So your easiest path would be using localhost networking to connect to the teensy_gateway program.

A much more difficult path would be trying to splice the USB Disk and USB Serial code together. That might be possible, but it's not easy to edit the USB code.

Hi Paul,

Since I'm having trouble sending data to Teensy while it's in USB Disk+USB Keyboard mode, I'd like to try the difficult path. Can you give some hints/guidelines on how to do this? :) Thanks!
 
Hi paul,

I was wondering how can I have multiple Teensys connected to the same computer and have their data sent over? Is the teensy gateway program capable of receiving data from multiple Teeensys on the same localhost port?
 
Status
Not open for further replies.
Back
Top