Samson Carbon 49 needs to be plugged in twice [solved]


#1

I have an issue when first plugging in one of my usb midi keyboards (or having it already plugged in on boot). The first time the keyboard isn’t properly recognised. Hitting keys results in screen navigation events instead of notes being played.

It starts working properly if it is unplugged and replugged. Here is the journal for the first time its plugged in:

May 29 22:24:21 zynthian kernel: usb 1-1.2: new full-speed USB device number 4 using dwc_otg
May 29 22:24:21 zynthian kernel: usb 1-1.2: New USB device found, idVendor=1234, idProduct=5678
May 29 22:24:21 zynthian kernel: usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
May 29 22:24:21 zynthian kernel: usb 1-1.2: Product: SAMSONG Carbon49 
May 29 22:24:21 zynthian kernel: usb 1-1.2: Manufacturer: James Lam
May 29 22:24:21 zynthian kernel: usb 1-1.2: SerialNumber: FF17406A3834
May 29 22:24:21 zynthian kernel: input: James Lam SAMSONG Carbon49  as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.1/input/input1
May 29 22:24:21 zynthian kernel: usbcore: registered new interface driver usbtouchscreen
May 29 22:24:21 zynthian kernel: usbcore: registered new interface driver snd-usb-audio

And the second time:

May 29 22:26:31 zynthian kernel: usb 1-1.2: new full-speed USB device number 5 using dwc_otg
May 29 22:26:31 zynthian kernel: usb 1-1.2: New USB device found, idVendor=1234, idProduct=5678
May 29 22:26:31 zynthian kernel: usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
May 29 22:26:31 zynthian kernel: usb 1-1.2: Product: SAMSONG Carbon49 
May 29 22:26:31 zynthian kernel: usb 1-1.2: Manufacturer: James Lam
May 29 22:26:31 zynthian kernel: usb 1-1.2: SerialNumber: FF17406A3834
May 29 22:26:31 zynthian jackd[353]: scan: added port hw:1,0,0 in-hw-1-0-0-SAMSONG-Carbon49-MIDI-1
May 29 22:26:31 zynthian jackd[353]: scan: added port hw:1,0,0 out-hw-1-0-0-SAMSONG-Carbon49-MIDI-1
May 29 22:26:31 zynthian jackd[353]: scan: opened port hw:1,0,0 in-hw-1-0-0-SAMSONG-Carbon49-MIDI-1
May 29 22:26:31 zynthian jackd[353]: scan: opened port hw:1,0,0 out-hw-1-0-0-SAMSONG-Carbon49-MIDI-1

It looks like jackd isn’t picking it up on the first time. This only happens with the samsong, I can’t make it happen with my Korg nanokey.

I can try debugging this myself if you can point me in the right direction.


#2

Its like the first time it gets registered as an input device:

May 29 22:24:21 zynthian kernel: input: James Lam SAMSONG Carbon49  as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.1/input/input1

#3

I think the Carbon49 usb data is too sparse or bogus and is triggering some catch-all input rule. I’ll be changing my midi controller soon anyway so I can put up with this behaviour for now.


#4

Can you check how many MIDI sub-devices creates your keyboard? Sometimes this is a problem …

Regards!


#5

I’ve had similar problems with my Carbon 49. Device is recognised when Zynthian is rebooted, but midi doesn’t work until the keyboard is unplugged/replugged. I can kinda live with it,…


#6

Is the Carbon 49 the only MIDI-USB device connected to Zynthian?


#7

I also have a Korg nanoKEY2 which works just fine plugged in in whatever order.

I think I’ve found the problem, the first time the Carbon49 is plugged in the usbtouchscreen driver gets loaded

# lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
        |__ Port 2: Dev 4, If 0, Class=Audio, Driver=snd-usb-audio, 12M
        |__ Port 2: Dev 4, If 1, Class=Audio, Driver=usbtouchscreen, 12M

So now I’ve done this and it works first time

root@zynthian:~# cat /etc/modprobe.d/usbtouchscreen.conf 
blacklist usbtouchscreen

I assume there won’t be a zynthian box which needs the usbtouchscreen driver, so I’ll propose this to zynthian-sys


#8

Have had issues with Roland GR20 to midi to usb interface in to the Zynthian. have deduced the problem is that Roland sends out a Midi Time Code sync command every 3 seconds which the gives the os a problem at boot up if I turn on the GR20 after boot up then no problem.


#9

The Carbon49 issue also happens the first time it is plugged in after boot.


#10

What happens if you use a midi cable from Carbon49 into Zynthian?


#11

I haven’t wired up my midi socket yet :slight_smile:


#12

have you plugged it into a computer and use a program like MIDI Monitor to see what data Carbon49 is sending when Idle?


#13

I haven’t. I think the problem is fixed by blacklisting usbtouchscreen, so I’m happy now.


#14

Hi Steve!

I’m not sure of blacklisting the usbtouchscreen driver. There are people using different displays, some of them with USB touch interface, so we have to find a better solution.

It seems that the driver is loading incorrectly, so perhaps we can solve tweaking some rule of the udev system (/etc/rules.d):

https://wiki.archlinux.org/index.php/udev

Regards!


#15

OK, I’ll see if I can come up with an authorized=0 udev rule


#16

OK, I have another /etc/modprobe.d/ based fix. The Carbon49 usb data has vendor=1234 product=5678, which is not unique and clashes with an alias rule in /lib/modules/4.9.24-v7+/modules.alias that loads usbtouchscreen

This rule is much more specific, and is unlikely to affect usbtouchscreen devices that may be used by zynthian users:

# cat /etc/modprobe.d/carbon49-alias.conf 
# Ensure the Samson Carbon 49 loads the snd-usb-audio instead of
# usbtouchscreen. This midi controller has the non-unique 
# vendor=1234 product=5678
alias usb:v1234p5678d*dc*dsc*dp*ic*isc*ip*in* snd-usb-audio

#17

I’ve fixed up the pull-request, sorry about the churn.


#18

Great, @steveb!

I’ve merged your changes into the master branch and it will be included in the next update bundle :wink:

Thanks a lot!