Teensy Serial in and USB

Status
Not open for further replies.

Erikson.S

New member
Hello all!
I am really new in the programming world, and this may be a long shot but, here I am!
First of all, I did not buy a teensy yet. I decided to clarify everything first, so I could be sure if I could give the teensy a shot!
I am from Brazil and buying stuff here has been a bit complicated. Everything is really expensive because of the dolar/brl conversion rate.
That's why I did not buy one yet...
Anyways, what I am trying to achieve is not that hard (well, I assume?).
I want a USB Midi capable device, that can also receive serial messages.
I have read some topics but I did not find what I wanted or did not understand it properly (maybe it was only a language barrier?).

I want a midi USB device that can control VST's such as Guitar Rig and DAW's such as Reaper!
But I also want this midi USB device to be able to receive serial input messages, so I can , for example, change the CC range I want to use and so on.
I can already communicate with an arduino, change parameters and etc using serial.
But the main problem is : either I use a virtual midi cable such as hairless and loop midi, or I use the hiduino firmware.
While the hiduino is OK, having to disconnect and connect the arduino every time I want to toggle between USB and hid MIDI, is a pita!

Well... that's it! Can I use the teensy both as usb midi and serial at the sabe time?
If yes, this is 80% of the way for me to buy it!

Thanks in advance!
 
No problem, you can use USB serial and USB MIDI at the same time, it's one of the USB type options. Teensy also has standard support for multiple virtual MIDI cables so you can also go that route.
Just install the Teensyduino software and have a look at the examples. Also check the Using USB MIDI page.
 
Hey Gerrit! Thanks a lot for such a kind and well explained answer!
I'll grab one as soon as I can, then!
In regards of renaming the serial name, in a way it can appear with other name on the device manager, is it possible? I've read that there are some ways to rename it as USB device, but as serial, is it possible? I've read that a file called "name.h" (or .c?) along with my sketch can do some things related to it!
Please excuse me if I am asking too much or if this questions were already answered!
 
I don't know if and how this can be done for the USB serial, I only use it for debugging. Renaming the MIDI device is in the examples. You should check the page on USB serial if this:
The Teensy does not actually become a serial device until your sketch is running, so you must select the serial port (Tools -> Serial Port menu) after your sketch begins.
has consequences for your project. I must admit that I have very little experience with sending serial data from a PC to a Teensy.
 
In regards of renaming the serial name, in a way it can appear with other name on the device manager, is it possible? I've read that there are some ways to rename it as USB device, but as serial, is it possible? I've read that a file called "name.h" (or .c?) along with my sketch can do some things related to it!

For the MIDI name, click File > Examples > Teensy > USB_MIDI > MIDI_name.

For Serial, changing the name is complicated and generally not done, because the name isn't normally shown to users. On all 3 platforms, the system assigns names (eg, COM3, /dev/ttyACM0, /dev/cu.usbmodem3812021, etc). The name used by USB isn't normally seen, so there's usually not much reason to change it.

Windows also adds another layer of complexity with its INF files. Even if you change the name in the USB descriptors, the name Windows shows in its Device Manager is the name within the INF file which matched the device. Windows never shows users the USB descriptor string, unless there's no driver at all and it appears as an unknown device.

On Windows 10, Microsoft provides the .INF as part of the operating system. You probably would not edit that file, even if you could.

On older versions of Windows, the Teensyduino installer adds an .INF (unless you click the button to skip that step).

All versions of Windows allow you to craft your own INF files using more Hardware-Id specific matching, so that they override the system-provided ones with Compatible-Id matching. Lots of info about this is buried on Microsoft's MSDN site, but honestly it's quite convoluted and the documentation is fragmented at best, so difficult to learn the details of making INFs.

But you can't just edit these .INF files easily, even though they're plain text (but stored in a hidden folder), because they're accompanied by .CAT files that have a digital signature. Starting on Windows 7, Microsoft requires .INF files to have a valid signature in their .CAT file. You can create a .CAT file for your .INF using Microsoft's INF2CAT.EXE utility. Then you can give the .CAT file a signature with SIGNTOOL.EXE. However, SIGNTOOL.EXE requires a digital certificate, which is not free. The best price I've found for the certificates is from K-Software. Their site has lots of good info too.

A very long time ago, back in the Window XP days, you couldn't sign your own INFs. You had to pay Microsoft. Thankfully those days are long gone. Still, quite a bit of misinformation remains. A lot of people bitterly hate Microsoft and the notion that they still require direct payment for signing really resonates with people who know nothing of how this system works. You don't need to pay Microsoft anything (other than for Windows itself), but you do have to get a certificate from one of the certificate authorities which SIGNTOOL.EXE trusts.

INF2CAT.EXE and SIGNTOOL.EXE are part of the (enormous) free Window Driver Kit. It is a huge download just to get those 2 utilities, but it's free from their site.

For Linux and Macintosh, simply editing the USB descriptors in usb_desc.c is enough. But again, this usually isn't needed because users only see this info if they use tools like "lsusb" on Linux or System Report on Mac.
 
Thanks again for your input, Gerrit!

And Paul, Wow! Your answers are always spot on! Very informative!
So, with all that you said, is there a way I can "hide" the real name from the user but, at the same time, use serial communication ?

What I will try to achieve in this project is quite simple (I have done using arduino, so I think its not hard to achieve on Teensy):
I will have this USD Midi device, and I am planing to make it easily configurable.
And I plan doing this using EEPROMS to store the CC, PC or whatever midi value.
So, lets say I'll Use EEPROM[0] to store one value.
I'll use a simple java interface that will "tell" what number I want the EEPROM[0] to store.
But for that to work (at least in my very limited knowledge), I need to "point" which serial port is being used, so the infos will be sent via serial and stored on the EEPROM.
Do you understand? (sometimes I find it a bit hard to explain what I am trying to achieve).
I hope I made myself clear and hope that there's a way to achieve what I wish!
Thanks in advance!
Cheers :)
 
Windows also adds another layer of complexity with its INF files. Even if you change the name in the USB descriptors, the name Windows shows in its Device Manager is the name within the INF file which matched the device. Windows never shows users the USB descriptor string, unless there's no driver at all and it appears as an unknown device.

Windows do show at least part of the USB descriptor string. It's in the "Bus reported device description" in the "details" tab in the device manager. One can get this information from the powershell command:

Code:
(Get-WMIObject Win32_PnPEntity | where {$_.name -match "<your_device_name>"}).GetDeviceProperties("DEVPKEY_Device_BusReportedDeviceDesc").DeviceProperties.Data
 
Last edited:
Status
Not open for further replies.
Back
Top