I’ve just started my Rock Pi S adventure and have a little problem.
Ultimately, I want to connect it to my PC as a multi-port MIDI device translation unit - I’ve got a set of cascaded eMagic amt8/Unitor8 devices which are attached to a Windows PC. Unfortunately, eMagic was bought by Apple quite some years ago, and since this time, no new Windows MIDI drivers for their nonstandard USB implementation have been created - the last one is for Windows XP, 32-bit. My machines, unfortunately, are all 64-bit Windows 10, so … no joy, no MIDI. Replacing my whole studio infrastructure would be no fun, and would come at a high price, so why not add a little intermediary device?
Enter stage from the left: Rock Pi S!
In theory, this little fellow should allow me to set up the OTG port as a set of standard MIDI devices, with 8 input/output ports each. Then connect the amt8/Unitor8 cascade to the host port, implement a little “magic translation program” in the middle, and off we go … at least, I hope that’s how it will work.
First step: let my Windows PC see the Rock Pi S as a set of MIDI devices. To do so, I did the following:
1. Disable ADB
That was easy:
systemctl stop rockchip-adbd systemctl disable rockchip-adbd
did the trick, as per the documentation at https://wiki.radxa.com/RockpiS/dev/usbnet
2. Set up the MIDI devices
Hmmm … not as easy, but doable. Following a modified version of the method I found here, I created a file called /usr/bin/create-midi-gadgets with the following content:
#!/bin/sh # Load libcomposite modprobe libcomposite # Create a gadget called usb-gadgets cd /sys/kernel/config/usb_gadget/ mkdir -p usb-gadgets cd usb-gadgets # Configure our gadget details echo 0x1d6b > idVendor # Linux Foundation echo 0x0104 > idProduct # Multifunction Composite Gadget echo 0x0100 > bcdDevice # v1.0.0 echo 0x0200 > bcdUSB # USB2 mkdir -p strings/0x409 echo "fedcba9876543210" > strings/0x409/serialnumber echo "Rock Pi S Gadget" > strings/0x409/manufacturer echo "Rock Pi S Gadget" > strings/0x409/product mkdir -p configs/c.1/strings/0x409 echo "MIDI Multi" > configs/c.1/strings/0x409/configuration echo 250 > configs/c.1/MaxPower # MIDI gadget 1 mkdir -p functions/midi.usb0 # id - ID string for the USB MIDI adapter echo "rock-midi-1" > functions/midi.usb0/id echo "8" > functions/midi.usb0/in_ports echo "8" > functions/midi.usb0/out_ports ln -s functions/midi.usb0 configs/c.1/ # MIDI gadget 2 mkdir -p functions/midi.usb1 # id - ID string for the USB MIDI adapter echo "rock-midi-2" > functions/midi.usb1/id echo "8" > functions/midi.usb1/in_ports echo "8" > functions/midi.usb1/out_ports ln -s functions/midi.usb1 configs/c.1/ # End functions ls /sys/class/udc > UDC
(created as root, followed by chmod u+x).
Then I created a service definition for that in /etc/systemd/system/create-midi-gadgets.service :
[Unit] Description=Create MIDI gadgets [Service] Type=oneshot ExecStart=/usr/bin/create-midi-gadgets StandardInput=tty RemainAfterExit=yes [Install] WantedBy=multi-user.target
and made sure the Rock Pi S boots with that:
systemctl daemon-reload systemctl enable create-midi-gadgets
and hey … when I boot the S attached to my PC, up come two MIDI devices! Yay!
… or not so yay.
While I did configure different IDs for the MIDI devices (they should be called “rock-midi-1” and “rock-midi-2”), the IDs are obviously not used by the created gadget. Windows sees them as:
MIDI function MIDI function
and the enumerated MIDI devices have the names
MIDI function MIDIIN2 (MIDI function) MIDIIN3 (MIDI function) MIDIIN4 (MIDI function) MIDIIN5 (MIDI function) MIDIIN6 (MIDI function) MIDIIN7 (MIDI function) MIDIIN8 (MIDI function) MIDI function MIDIIN10 (MIDI function) MIDIIN11 (MIDI function) MIDIIN12 (MIDI function) MIDIIN13 (MIDI function) MIDIIN14 (MIDI function) MIDIIN15 (MIDI function) MIDIIN16 (MIDI function)
(same “logic” for the output ports).
So, 2 have the same name, which is bad.
Does anybody know what I have to correct in my little script to assure that the IDs are used?
I used rockpis_debian_buster_minimal_arm64_20200809_0853-gpt.img, in case this is relevant.
Thank you very much!