Linux driver for embedded Linux - linux

I'm looking to attach some USB devices to my embedded Linux board.
It is an TI-ARM processor running embedded Linux, but I guess it could be any embedded Linux board.
If I purchase an USB device which has Linux support/driver, can this driver (generally) be re-compiled to work with the ARM architecture? (Instead of Windows ect.).

Yes, USB drivers can generally be expected to compile for other architectures other than x86. Of course this presumes that your board does have a host USB port. There are a few boards that have only USB device ports, and many SoCs have both USB host & device ports.
But successfully compiling the (USB) driver may only be part of the task.
Some (USB) devices may require additional packages of libraries and other drivers for interfacing to application programs. For instance a USB digital TV tuner requires numerous packages (V4L, ALSA, I2C driver, userland firmware loading) to actually work.
Clarification
These additional dependencies that you may have to build are not because of USB.
The dependencies are related to the type of device.
An Ethernet interface, whether integrated into the SoC or offboard using USB, would be easily configured for full support in the kernel (e.g. protocol stack) and userland (e.g. Busybox has ifconfig, ping and routing apps).
A PCI TV tuner would have the same dependencies as the USB tuner. But the embedded environment typically means that you don't have any/most of these multimedia dependencies already built/installed.

Related

Enable mass storage and ethernet over USB or a terminal device function over USB in Kubos Linux

I've been trying to emulate the ethernet over USB functional or a terminal device over USB function in Kubos Linux (https://docs.kubos.com/1.21.0/index.html).
The version of linux kernel is 4.4.23. The Kubos Linux is deployed on beaglebone black and uses uboot to boot the linux. I have enabled CONFIG_USB_NET_DRIVERS in the linux-kubos.config which you can see here: https://github.com/kubos/kubos-linux-build/blob/master/board/kubos/beaglebone-black/linux-kubos.config. After this I compiled the linux and created a kubos-linux.img and aux-sd.img and flashed the SD card. I booted the board from SD card however, I still could not see the ethernet over USB emulation after the flash.
I use buildroot for compiling and building the kubos kernel and aux image in the vagrant VM in virtual box.
I wanted to know if I am missing some key information to add these functionalities and if there were any beaglebone black specific driver configuration I need to enable in kubos linux kernel?
At the moment, I use an FTDI cable to communicate with the board serially using minicom however, this is very slow and want to use ethernet over USB or terminal functionality to make this communication faster.

how usb gadget driver upper layer driver get loaded?

My embedded linux board has usb-net gadget functionality. From my host computer I am able to establish ethernet over usb connectivity. I am trying to understand how the different layers of the usb gadget subsystem layers work together.
In the device tree, I can see the platform specific udc driver and in the kernel configuration I can see the USB Gadget and Ethernet Gadget support being enabled in the kernel drivers. So as I understand the g_ether driver gets built-in part of the kernel.
What configuration creates the usb gadget interface and endpoint and links it to the upper layer driver (g_ether) and creates the usb-net gadget ethernet interface ?
Where to define the usb class function of the gadget and load a different upper layer driver ?
I am running version 5.10.36 kernel on my system. After some research and study, this is what I know so far.
So during linux kernel build, I have following option setup in menuconfig.
Symbol: USB_ETH [=m]
Prompt: Ethernet Gadget (with CDC Ethernet support)
Defined at drivers/usb/gadget/Kconfig:628
Depends on: <choice> && NET
Location:
-> Kernel configuration
-> Device Drivers
-> USB support (USB_SUPPORT [=y])
-> USB Gadget Support (USB_GADGET [=y])
-> USB Gadget Drivers (<choice> [=y])
This configuration gives a predefined USB net gadget interface with CDC ethernet support and required end-point configuration. This driver is g_ether.
The end point configuration is predefined in the file
drivers->usb->gadget->function->f_ecm.c
configFS can be used to configure a custom usb gadget interface from the user-space level.

What do I need to do to set up usb audio gadget i/o on a beaglebone running debian?

I want to use alsa on a Beaglebone Black to send audio through usb audio out and receive it on my computer.
I have seen that there are some gadgets in a legacy folder in the kernel, and seen some tutorials on how to set up mass storage and network gadgets, but I am confused about what the state of audio gadgets is and what to compile and configure for this.
Can you explain the various components and configurations that need to go into place to make this happen, covering which kernel modules, drivers, kinds of scripts, and configurations that might be needed to do this?
You need to enable USB gadget subsystem in your Linux kernel for Beaglebone Black. Assuming of course that you have USB device controller and USB device connector on your Beaglebone. Here there are more information:
https://www.lynxbee.com/usb-audio-gadget-driver/
USB devices contains so called USB descriptors which tells USB host (PC) as a what device type it works. Audio gadget is one of the type of that descriptor that tells that this device (in this case BeagleBone) should be working as a audio device.

Tracing traffic in Linux-based usb gadget (CDC/NCM)

I have a linux platform* that is connected as a usb device to an automotive device which acts as the USB host. The two devices should communicate over CDC/NCM, but the linux platform is not recognised by the automotive device and therefore the connection is not established. Surprisingly a connection to my computer is established correctly.
I now need to create a trace of that USB connection in order to check if there is an error in the USB handshake that can't be handled by the automotive device. As I cannot access the USB host, I need to create the trace from the gadget side.
I tried using usbmon and tcpdump, but this seems to work only for USB controllers configured as hosts on the tracing platform, not for ones configured as devices.
How can I configure usbmon to work also on devices?
If that is not possible are there any other possibilities to achieve this? (preferrably without hacking any drivers...)
Or do I have to use a Hardware USB sniffer?
BTW, all required modules (esp. g_ncm) are correctly loaded.
Thank you for your help!
stefan
*custom distribution on a freescale iMX6 processor (ARM), Kernel Version 3.0.35

Bluetooth Module Appears Not to Be working

I've built a Buildroot linux image for my PhidgetSBC and included bluetooth support unfortunately it appears my bluetooth USB dongle isn't working. Although I have not tested it with code it's internal LED does not illuminate when I plug it in.
When I issue lsmod I see this:
Module Size Used by Not tainted
usb_storage 33699 -
btusb 8560 -
bluetooth 50130 -
It appears bluetooth is in the kernel but how could I test my usb dongle?
This is definitely not Buildroot related, but rather hardware and kernel configuration rleated. Unfortunately, you're giving way too few details: which Bluetooth USB dongle you're talking about, what kernel version using, what is your kernel configuration, etc.
First of all, check if your USB device appears when running lsusb.

Resources