Hello I'm running a pure data patch that uses a (class compliant) midi keyboard input via the USB port. When I run the patch in the IDE everything works fine. But when it runs on boot it doesn't receive the midi data. Otherwise the patch runs fine in run on boot mode, it's just the midi that is not working. When the patch first loads on boot in the IDE I see a message says No MIDI device enabled. Once I click the build and Run button on the exact same patch it shows "The following Midi devices are enabled 0 hw: 1, 0, 0 x (1-16)" I tried using an externally powered USB hub and another controller that has its own power and got the same results. I also tried other patches including the hello midi example patch and exact same results. I also tried sending a loadbang hw 1 0 0 message to the bela_setMidi but and got the following messages:
Failed call to __wrap_bind: 17 File exists
Error while creating pipe bela-midiOut_hw:1,0,0: Operation not permitted
Any ideas?
alt text

alt text

it's a known bug which will be fixed in the next release of the Bela image. In the meantime, do the following:

In the console at the bottom of the IDE paste this line and hit enter:

printf "libcomposite\nrtdm_pruss_irq\nsnd_usb_audio\nsnd_usbmidi_lib\nspi_gpio\n" > /etc/modules

reboot and it should work fine

Ok great, it fixed it. Thanks so much. Will be sure to update when it comes out. Should I do that every time I load a new patch?

no, it's done once for all: it's a system-level change.

5 days later
3 months later

I reflashed my bela to this new image but now I don't get any midi input even on the IDE...by default it says No MIDI device enabled...Any ideas off the top of your head?

Thanks,

Tom

    tkay I reflashed my bela to this new image but now I don't get any midi input even on the IDE...by default it says No MIDI device enabled...Any ideas off the top of your head?

    Does this happen only when running the project at boot or also during regular operation?

    Can you run amidi -l in the console at the bottom of the IDE and report its result?

    it doesn't receive any midi either on boot or on the ide

    so the device is not showing up (hw:0,0 is the virtual interface over USB between Bela and yout computer)

    What about lsusb -l ?

    What MIDI device is connected? Does it require external power? Does it have any LEDs on it showing that it's receiving power?

    Its a cheap usb powered keyboard...But it worked fine before. I also tried a powered nord keyboard and same thing happened...

    it does have LED and it shows as being powered

    it says invalid option ...if I use the v function it says this:

        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        0
          bAlternateSetting       0
          bNumEndpoints           1
          bInterfaceClass         9 Hub
          bInterfaceSubClass      0 Unused
          bInterfaceProtocol      0 Full speed (or root) hub
          iInterface              0 
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x81  EP 1 IN
            bmAttributes            3
              Transfer Type            Interrupt
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0004  1x 4 bytes
            bInterval              12
    Hub Descriptor:
      bLength               9
      bDescriptorType      41
      nNbrPorts             1
      wHubCharacteristic 0x0011
        Per-port power switching
        No overcurrent protection
        TT think time 8 FS bits
      bPwrOn2PwrGood        5 * 2 milli seconds
      bHubContrCurrent      0 milli Ampere
      DeviceRemovable    0x02
      PortPwrCtrlMask    0xff
     Hub Port Status:
       Port 1: 0000.010c power oc suspend
    Device Status:     0x0001
      Self Powered
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Device Descriptor:
      bLength                18
      bDescriptorType         1
      bcdUSB               2.00
      bDeviceClass            9 Hub
      bDeviceSubClass         0 Unused
      bDeviceProtocol         1 Single TT
      bMaxPacketSize0        64
      idVendor           0x1d6b Linux Foundation
      idProduct          0x0002 2.0 root hub
      bcdDevice            4.14
      iManufacturer           3 Linux 4.14.108-ti-xenomai-r135 musb-hcd
      iProduct                2 MUSB HDRC host driver
      iSerial                 1 musb-hdrc.0
      bNumConfigurations      1
      Configuration Descriptor:
        bLength                 9
        bDescriptorType         2
        wTotalLength           25
        bNumInterfaces          1
        bConfigurationValue     1
        iConfiguration          0 
        bmAttributes         0xe0
          Self Powered
          Remote Wakeup
        MaxPower                0mA
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        0
          bAlternateSetting       0
          bNumEndpoints           1
          bInterfaceClass         9 Hub
          bInterfaceSubClass      0 Unused
          bInterfaceProtocol      0 Full speed (or root) hub
          iInterface              0 
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x81  EP 1 IN
            bmAttributes            3
              Transfer Type            Interrupt
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0004  1x 4 bytes
            bInterval              12
    Hub Descriptor:
      bLength               9
      bDescriptorType      41
      nNbrPorts             1
      wHubCharacteristic 0x0011
        Per-port power switching
        No overcurrent protection
        TT think time 8 FS bits
      bPwrOn2PwrGood        5 * 2 milli seconds
      bHubContrCurrent      0 milli Ampere
      DeviceRemovable    0x02
      PortPwrCtrlMask    0xff
     Hub Port Status:
       Port 1: 0000.0

      tkay it says invalid option ...if I use the v function it says this:

      sorry it would have been just lsusb (without options), could you please try again?

      Can you also show the output of:

      lsmod

      ?

      Then:
      - unplug the MIDI device
      - wait 5 seconds
      - plug in the MIDI device
      - run dmesg | tail -n 20 and show the output of this command

      In all this, can you try a different USB cable for the device and verify whether that is the issue? Some cables only carry power and not carry data. Some socket connectors may also prevent the plug from being fully inserted, obtaining a similar result (only power, no data) [which is - by the way - what happened to me a minute ago].

      Thanks for such quick responses
      lsubs threw this at me:

      root@bela ~/Bela# lsusb
      Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
      Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

      lsmod said this:

      root@bela ~/Bela# lsmod
      Module Size Used by
      ti_am335x_adc 16384 0
      kfifo_buf 16384 1 ti_am335x_adc
      industrialio 73728 2 ti_am335x_adc,kfifo_buf
      usb_f_midi 20480 2
      usb_f_acm 16384 2
      u_serial 20480 3 usb_f_acm
      usb_f_mass_storage 53248 2
      usb_f_ncm 28672 2
      usb_f_rndis 32768 2
      u_ether 20480 2 usb_f_ncm,usb_f_rndis
      omap_rng 16384 0
      rng_core 16384 1 omap_rng
      pwm_tiehrpwm 16384 0
      c_can_platform 16384 0
      c_can 20480 1 c_can_platform
      can_dev 28672 1 c_can
      spidev 20480 0
      evdev 24576 1
      ti_am335x_tscadc 16384 1 ti_am335x_adc
      uio_pdrv_genirq 16384 0
      spi_gpio 16384 0
      spi_bitbang 16384 1 spi_gpio
      snd_usb_audio 184320 0
      snd_hwdep 16384 1 snd_usb_audio
      snd_usbmidi_lib 32768 1 snd_usb_audio
      snd_rawmidi 32768 2 snd_usbmidi_lib,usb_f_midi
      snd_seq_device 16384 1 snd_rawmidi
      rtdm_pruss_irq 16384 0
      libcomposite 65536 16 usb_f_acm,usb_f_ncm,usb_f_mass_storage,usb_f_rndis,usb_f_midi
      ip_tables 24576 0
      x_tables 32768 1 ip_tables
      root@bela ~/Bela#

      and after unpluging and pluging the keyboard and running dmesg | tail -n 20 it said this:

      [ 18.363011] LUN: removable file: (no medium)
      [ 23.476378] ti_am3359-tscadc 44e0d000.tscadc: chan 0 step_avg truncating to 16
      [ 23.476400] ti_am3359-tscadc 44e0d000.tscadc: chan 1 step_avg truncating to 16
      [ 23.476409] ti_am3359-tscadc 44e0d000.tscadc: chan 2 step_avg truncating to 16
      [ 23.476418] ti_am3359-tscadc 44e0d000.tscadc: chan 3 step_avg truncating to 16
      [ 23.476427] ti_am3359-tscadc 44e0d000.tscadc: chan 4 step_avg truncating to 16
      [ 23.476436] ti_am3359-tscadc 44e0d000.tscadc: chan 5 step_avg truncating to 16
      [ 23.476445] ti_am3359-tscadc 44e0d000.tscadc: chan 6 step_avg truncating to 16
      [ 23.476454] ti_am3359-tscadc 44e0d000.tscadc: chan 7 step_avg truncating to 16
      [ 24.472524] usb0: HOST MAC be:1a:05:fb:7d:b9
      [ 24.492209] usb0: MAC be:1a:05:fb:7d:ba
      [ 24.504087] usb1: HOST MAC be:1a:05:fb:7d:bc
      [ 24.504457] usb1: MAC be:1a:05:fb:7d:bd
      [ 27.485059] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
      [ 28.518448] IPv6: ADDRCONF(NETDEV_UP): usb1: link is not ready
      [ 28.700546] configfs-gadget gadget: high-speed config #1: c
      [ 28.701482] IPv6: ADDRCONF(NETDEV_CHANGE): usb0: link becomes ready
      [ 31.008798] IPv6: ADDRCONF(NETDEV_CHANGE): usb1: link becomes ready
      [ 308.926109] rtdm_pruss_irq_close
      [ 312.528881] rtdm_pruss_irq_open
      root@bela ~/Bela#

      I also tried 2 different cables

      really weird ... can you try the Nord keyboard again and lsusb and amidi -l ?

      ok will do and report back tomorrow, have to leave the studio now...I should mention that I also ran the first script that you gave me before the new image came out...