简体   繁体   中英

Detect Ubuntu device as a MIDI keyboard/Interface in Windows

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM