Closed jsiddall closed 1 year ago
Hi, #define
is only necessary when you're defining the macro. When using it, you should do it without the keyword. For example, see here:
Use a line as such:
USBMIDI_DEFINE_PRODUCT_NAME('b', 'l', 'o', 'k', 'a', 's', '.', 'i', 'o');
Gaah, thanks for setting me straight. I had tried using the macro (without re-defining it) in it's own .cpp file as a test but, looking back, I failed to include usbmidi.h in that file.
Now, having got it successfully compiled and uploaded, I still just see the default device info:
Oct 27 09:30:57 kernel: [855326.412257] usb 1-7.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Oct 27 09:30:57 kernel: [855326.412260] usb 1-7.3: Product: Arduino Leonardo
Oct 27 09:30:57 kernel: [855326.412262] usb 1-7.3: Manufacturer: Arduino LLC
Interestingly, the MIDI device name seems to be something different, with "MIDI 1" added:
$ amidi -l
Dir Device Name
IO hw:4,0,0 Arduino Leonardo MIDI 1
Given this hardware, is there any way to change any of those values?
It's just something that Linux's USB MIDI driver does on its own accord. :)
Yeah, I figured ALSA was probably just enumerating it based on the product and device type.
Is there any hope for changing the product or manufacturer on an ATmega32u4? Is that buried in a bootloader or something?
If it's using the Pluggable USB implementation of USB MIDI, then it can't be changed from within USBMIDI.
If it is Pluggable USB, then it's defined somewhere in the board support files.
According to the "other" MIDI USB project:
Furthermore, since PluggableUSB only targets boards with native USB capabilities, this library only supports these boards (eg. Leonardo, Micro, Due, Zero and so on) For more information about this library please visit us at http://www.arduino.cc/en/Reference/MIDIUSB
So, sounds like it should be possible. I will see if I can dig some more.
I found USBCore.cpp has:
#if USB_VID == 0x2341
# if defined(USB_MANUFACTURER)
# undef USB_MANUFACTURER
# endif
# define USB_MANUFACTURER "Arduino LLC"
...but changing that value and recompiling had no effect.
boards.txt also has a line in the Leonardo section
leonardo.build.usb_product
but again, changing had no effect. Hmmm...
Other bootloaders (ex: gemma) do make references to changing USB information (see: usbconfig.patch
) but I am not sure if that would even work. Pretty sure I don't want to dive that deep.
After changing boards.txt I think you probably have to restart the Arduino IDE for changes to take place, at least I think I had such experience myself a little while ago when developing the boards.txt for Midiboy. This is outside of scope though of this issue on USBMIDI :) I think the best place to look for further assistance is the community forums of the particular Arduino board you're using.
After changing boards.txt I think you probably have to restart the Arduino IDE for changes to take place, at least I think I had such experience myself a little while ago when developing the boards.txt for Midiboy. This is outside of scope though of this issue on USBMIDI :) I think the best place to look for further assistance is the community forums of the particular Arduino board you're using.
Yes, you are correct, restarting and re-uploading worked for changing the usb_product in boards.txt. Thanks for the tip!
I tried defining a custom vendor name using the example in usbmidi.h:
#define USBMIDI_DEFINE_PRODUCT_NAME('b', 'l', 'o', 'k', 'a', 's', '.', 'i', 'o')
but get:
`Arduino/libraries/USBMIDI/src/usbmidi.h:77:37: error: "'b'" may not appear in macro parameter list
define USBMIDI_DEFINE_PRODUCT_NAME('b', 'l', 'o', 'k', 'a', 's', '.', 'i', 'o');
`
I also see a note "This works only on V-USB based implementation for now." but I am trying this on a Leonaredo-like board.
I also tried moving the define to a .cpp file but it fails with the same message.
Any ideas about how I can define my own vendor and product names?