1

I am creating a little experimentation application on my Odroid XU3 with Ubuntu 15.04 Lite. http://dn.odroid.com/homebackup/201407071058089142.jpg

The device (Odroid) receives midi as input via a keyboard connected via one of the available USB Host ports (this part is OK) and sents some other midi instructions (also via USB, but USB OTG) to the computer to create harmony (this part is not ok).

The use case is : you play on your midi keyboard some notes, the odroid received them, the embedded application code analyses them, find new notes (midi instructions) and send them to your Windows PC that you can root them to the VST of your choice.

The issue I have is that in order to achieve that, I need the Odroid device to appear as a MIDI keyboard in Windows that people can add the device in their Digital Audio Workstations.

Most of the midi controllers sold on the market have their own drivers but some are class compliant devices.

How can I make Windows detect this Odroid board an a midi keyboard? If I need to write a specific driver for that, from where to start?

Edit : Found g_midi drivers but not usb_f_midi

odroid@odroid:/lib/modules/3.10.72-23/kernel/drivers/usb/gadget$ ls -al
total 628   
drwxr-xr-x 2 root root  4096 May 23 21:28 .   
drwxr-xr-x 8 root root  4096 May 23 21:27 ..  
-rw-r--r-- 1 root root 37544 May 23 21:11 g_acm_ms.ko  
-rw-r--r-- 1 root root 17468 May 23 21:11 g_audio.ko  
-rw-r--r-- 1 root root 24164 May 23 21:11 g_cdc.ko  
-rw-r--r-- 1 root root 44488 May 23 21:11 g_ether.ko  
-rw-r--r-- 1 root root 63552 May 23 21:11 g_ffs.ko  
-rw-r--r-- 1 root root 16672 May 23 21:11 g_hid.ko  
-rw-r--r-- 1 root root 37084 May 23 21:11 g_mass_storage.ko  
-rw-r--r-- 1 root root 17468 May 23 21:11 g_midi.ko  
-rw-r--r-- 1 root root 69752 May 23 21:11 g_multi.ko  
-rw-r--r-- 1 root root 28164 May 23 21:11 g_ncm.ko  
-rw-r--r-- 1 root root 35396 May 23 21:11 g_nokia.ko  
-rw-r--r-- 1 root root 20944 May 23 21:11 g_printer.ko  
-rw-r--r-- 1 root root  9016 May 23 21:11 g_serial.ko  
-rw-r--r-- 1 root root 26628 May 23 21:11 g_webcam.ko  
-rw-r--r-- 1 root root 11408 May 23 21:11 g_zero.ko  
-rw-r--r-- 1 root root 25380 May 23 21:11 gadgetfs.ko  
-rw-r--r-- 1 root root 45940 May 23 21:11 libcomposite.ko  
-rw-r--r-- 1 root root 15244 May 23 21:11 u_serial.ko  
-rw-r--r-- 1 root root  9972 May 23 21:11 usb_f_acm.ko  
-rw-r--r-- 1 root root  8060 May 23 21:11 usb_f_obex.ko  
-rw-r--r-- 1 root root  6928 May 23 21:11 usb_f_serial.ko  
-rw-r--r-- 1 root root 14584 May 23 21:11 usb_f_ss_lb.ko  

Second edit : Thanks to CL Trying the g_midi driver

odroid@odroid:/proc/asound$ cat cards
0 [odroidaudio ]: odroid-audio - odroid-audio odroid-audio 
1 [MPK225 ]: USB-Audio - MPK225 Akai MPK225 at usb-12110000.usb-1.2, full speed 
2 [K61 ]: USB-Audio - Keystation 61 M-Audio Keystation 61 at usb-12110000.usb-1.3, full speed.

$ modprobe g_midi in_ports=1 out_ports=1

Error :

modprobe : ERROR : could not insert 'g_midi' : Device Or Ressource busy.

Same error with other ports (3,4, etc)

When removing the Midi keyboards :

odroid@odroid:/proc/asound$ cat cards
0 [odroidaudio ]: odroid-audio - odroid-audio odroid-audio 

$ modprobe g_midi in_ports=1 out_ports=1

same error :

modprobe : ERROR : could not insert 'g_midi' : Device Or Ressource busy.
BlackPopa
  • 163
  • 1
  • 11
  • Linux has a gadget driver for USB MIDI (`usb_f_midi.ko`), but I don't know if it is enabled in your Ubuntu. – CL. Jul 04 '15 at 19:17
  • Thanks for your answer. Is it the same as http://blackfin.uclinux.org/doku.php?id=linux-kernel:usb-gadget:midi ? – BlackPopa Jul 04 '15 at 20:55
  • `g_midi` is an older version. But you first need a kernel that actually has it enabled. – CL. Jul 05 '15 at 07:44
  • Thanks CL. I will try this first with my actual kernel to see if it's enabled. – BlackPopa Jul 05 '15 at 09:37
  • Edited the post with some drivers found. – BlackPopa Jul 05 '15 at 14:33
  • Ubuntu 15.04 should use kernel 3.19. Is that the kernel you're actually running (`uname -r`)? – CL. Jul 05 '15 at 16:07
  • It's using Kernel 3.10 81-33. It's the kernel used by default for Ubuntu 15.04 Lite with the distributed images from HardKernel (Odroid XU3 Lite) http://forum.odroid.com/viewtopic.php?f=95&t=13353 – BlackPopa Jul 05 '15 at 16:17

1 Answers1

1

Just load the g_midi module:

$ modprobe g_midi in_ports=1 out_ports=1

(1 and 1 are the defaults.)

This will create a class-compliant USB MIDI interface, which is visible on the Odroid like a normal sound card:

$ cat /proc/asound/cards
 0 [whatever       ]: ...
 1 [gmidi          ]: MIDI Gadget - g_midi
                      MIDI Gadget

... and can be accessed with the normal Linux MIDI APIs.

CL.
  • 173,858
  • 17
  • 217
  • 259
  • Edited my first post. Device Or Ressource busy error – BlackPopa Jul 05 '15 at 17:03
  • I don't know the limitations of the the XU3's OTG controller. Do `g_serial` or `g_ether` work? – CL. Jul 05 '15 at 17:03
  • modprobe g_serial doesn't return any error whereas modprobe g_ether returns : No such device. What I don't understand is how to target the OTG port (Odroid as Slave) and not the USB host ports (used as host input for the keyboards, odroid as Master) – BlackPopa Jul 05 '15 at 17:10
  • After I typed modprobe g_serial and connect the Windows PC via USB/USB OTG to the Odroid, it does appear as Windows is trying to install the driver. Gadget Serial v2.4 can be found in Unknown Devices in Windows – BlackPopa Jul 05 '15 at 17:19
  • On the properties of the device, it's written Port #0003 Hub #0001 (On Windows) – BlackPopa Jul 05 '15 at 17:25
  • So the OTG mechanism itself works; this busy error is a problem with the `g_midi` driver. Try asking on the Odroid forum. – CL. Jul 05 '15 at 17:31
  • Really appreciated your help thanks. I will update this thread when/if I have an answer on their side. – BlackPopa Jul 05 '15 at 17:42