Update to the cp210x usb driver on balenaOS

raspberrypi3

#1

We have a USB serial device that is not supported by the default cp210x driver. The source files need to be updated to add the VID and PID of the serial device, which can usually be done on a standard OS (Raspbian, etc.) by simply replacing the cp210x.ko module file.

I have compiled the driver in a Raspbian stretch container (build version) and that sometimes loads, but it would appear that the base balenaOS is also trying to load and there is a race condition / conflict with the containered OS trying to access the cp210x / usbserial module. No matter of how much rmmod / ins mod / modprob’ing that is done, it’s just not reliable or very repeatable.

Is there a way to have a custom module added to the base OS (which is read-only)? We have even tried to build the module with a different name to see if there is a conflict that way, but the balenaOS is still winning most of the time at grabbing the device. If the driver on the base OS could be updated, then this would not be an issue (as the container can access /dev/ttyUSB0 fine), it just does not recognise our dongle!

Any ideas on how we can progress on this, as otherwise it looks like we need to find a different solution.

Many thanks.


#4

Hi @branchespark,

You could remove the kernel module from the hostOS.

A disadvantage will be that you need to do this once for every board. Also if you choose to do a hostOS update from the dashboard the module will appear again after the OS updates.

Do you know if this device is supported in a newer linux kernel?

Regards!


#6

Thanks @spanceac. How do I remove the module from the hostOS, as it’s read only? Would it be possible to have this file replacement happen at build - does Balena yet support the configuration of the main hostOS?


#8

Hi @branchespark,

You can remount the filesystem with write permissions:
mount -o remount,rw /

We don’t support this kind of hostOS modification. You could however pull the sources from our github and build your own customized image.

Regards!


#10

@spanceac, thank you. Anywhere I can see an overview of the process of rolling our own hostOS and how to have this as an option to deploy on balenaCloud?


#19

Hi @branchespark, is it not possible to just rmmod the problematic one and then insmod your custom built one.

We are still working on the flow for including community contributed OSes to balenaCloud, but I think even in the case where we have them, having a custom OS just for a single kernel module change might be a bit overkill, so I think another approach would be preferable. Not to mention that maintaining and testing your own OS to keep up with balenaCloud can be a pain.


#21

@shaunmulligan - thanks for the idea.

What I have done is replaced the cp210x on the hostOS and then rammed / modprobe seems to reload it OK. Will keep testing to make sure, but it would be ace to be able to replace a file from the compose file / have the option when creating a new image.