Multifunction Composite Gadget Driver



  • Gadget drivers FunctionFS - rewrite of GadgetFS to support userspace gadget functions that can be combined into a USB composite gadget. USB Gadget ConfigFS - interface that allows definition of arbitrary functions and configurations to define an application specific USB composite device from userspace.
  • Now my win-7 PC showing 'Multifunction Composite Gadget' in device manager with yellow mark (no driver) can i get driver for this (win-7) i have installed driver for.
  • 27.069773 gmulti gadget: Multifunction Composite Gadget 27.121656 gmulti gadget: gmulti ready 27.168175 47401b00.usb-phy supply vcc not found, using dummy regulator 27.294194 musb-hdrc musb-hdrc.1: MUSB HDRC host driver 27.299592 musb-hdrc musb-hdrc.1: new USB bus registered, assigned bus numbe r 1.

Keep in mind though, that at the time of writing, no windows drivers are available – you need to use Linux or Mac OS X to connect to your Pi this way. Step 0 – configuring the SD card Download and install the latest Raspbian Jessie onto a suitably large SD card, and expand the root partition. DWC3 is a SuperSpeed (SS) USB 3.0 Dual-Role-Device (DRD) from Synopsys. Main features of DWC3: The SuperSpeed USB controller features.

uvc-gadget-configfs.sh

Multifunction Composite Gadget Driver Windows 7

#!/bin/bash
# set -e
cd /sys/kernel/config/usb_gadget/
mkdir -p g1
cd g1
echo 0x1d6b > idVendor # Linux Foundation
echo 0x0104 > idProduct # Multifunction Composite Gadget
echo 0x0100 > bcdDevice # v1.0.0
echo 0x0200 > bcdUSB # USB2
echo 0xEF > bDeviceClass
echo 0x02 > bDeviceSubClass
echo 0x01 > bDeviceProtocol
mkdir -p strings/0x409
echo'Ikestrom'> strings/0x409/manufacturer
echo'RPiZ Loopback Cam'> strings/0x409/product
echo'0123456789'> strings/0x409/serialnumber
mkdir -p configs/c.1
# echo '0x80' > configs/c.1/bmAttributes
echo'500'> configs/c.1/MaxPower
mkdir -p configs/c.1/strings/0x409
echo'UVC Config'> configs/c.1/strings/0x409/configuration
# Create UVC Functions
mkdir -p functions/uvc.usb0
create_function() {
# Example usage:
# create_function <width> <height> <format> <name>
WIDTH=$1
HEIGHT=$2
FORMAT=$3
NAME=$4
wdir=functions/uvc.usb0/streaming/$FORMAT/$NAME/${HEIGHT}p
mkdir -p $wdir
echo$WIDTH>$wdir/wWidth
echo$HEIGHT>$wdir/wHeight
echo 29491200 >$wdir/dwMinBitRate
echo 29491200 >$wdir/dwMaxBitRate
echo$(($WIDTH*$HEIGHT*2))>$wdir/dwMaxVideoFrameBufferSize
# dwFrameInterfal is in 100-ns units (fps = 1/(dwFrameInterval * 10000000))
# 333333 -> 30 fps
# 666666 -> 15 fps
# 5000000 -> 2 fps
cat <<EOF > $wdir/dwFrameInterval
333333
666666
5000000
EOF
}
# create_function 320 180 uncompressed u
# create_function 640 360 uncompressed u
create_function 1280 720 uncompressed u
# create_function 1920 1080 uncompressed u
# create_function 320 180 mjpeg m
# create_function 640 360 mjpeg m
# create_function 1280 720 mjpeg m
# create_function 1920 1080 mjpeg m
mkdir -p functions/uvc.usb0/streaming/header/h
cd functions/uvc.usb0/streaming/header/h
ln -s ../../uncompressed/u
# ln -s ../../mjpeg/m
cd ../../class/fs
ln -s ../../header/h
cd ../../class/hs
ln -s ../../header/h
cd ../../../control
mkdir -p header/h
ln -s header/h class/fs
ln -s header/h class/ss
cd ../../../
# Set the packet size: uvc gadget max size is 3k...
# echo 3072 > functions/uvc.usb0/streaming_maxpacket
echo 2048 > functions/uvc.usb0/streaming_maxpacket
# echo 1024 > functions/uvc.usb0/streaming_maxpacket
ln -s functions/uvc.usb0 configs/c.1
echo`ls /sys/class/udc`> UDC
Multifunction Composite Gadget Driver
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
  • 4Using CDC ACM + MS device with Linux host
  • 5Using CDC ACM + MS device with Windows 7 host
  • 7Mass storage endurance test

Introduction

This document explains the Communications Device Class (CDC) Abstract Control Model (ACM) + Mass Storage (MS) composite Linux gadget driver and how to use it with a Linux host PC and a Windows host PC.

CDC ACM + MS Linux gadget driver

The CDC ACM + Linux gadget MS driver is a USB composite gadget driver which implements the serial communication and mass storage functions. This allows the device to be registered on a host computer as a seral port (e.g. /dev/ttyACM0 or COM1:) and as a USB thumbdrive (e.g. /dev/sdf or E:). The composite driver allows for simultaneoususe of the serial and mass storage functions.

Driver support

The CDC ACM only driver that comes with the Linux kernel is supported on both Linuxand Windows. For Windows it is necessary the use of the following INF file:

Driver

Our experience shows the CDC ACM + MS composite USB driver is not well supported on Windows with this INF file. We have tested with a propretary solutions fromThesycon, with a demo version available at

  • Demo version of CDC ACM driver.

Linux host computers have full support for the CDC ACM + MS composite USB drivertwithout the need of additional files.

Multifunction Composite Gadget Driver Installer

Using CDC ACM + MS device with Linux host

Linux host device file identification

The following description is based on the host computer running Linux Ubuntu 10.04 LTS.

Once you attached the device, inspect the log to obtain the device file names usedon the host.

The serial communication port has been registed as 'ttACM0', meaning it will show up as '/dev/ttyACM0'. The mass storage device have been registered as 'sdf', meaning it will show up as '/dev/sdf'.

How to test the serial driver in Linux

In order to test the serial function on Linux you should need to install picocom

and use the picocom terminal emulator to display data received over the USB serial connection:

In order to send data from the target device we need to use the USB serial gadget driver device file '/dev/ttyGS0'. We can echo command to send data from thedevice to the Ubuntu host computer:

Multifunction composite gadget driver windows 7

After that you should see the text foo on picocom's output.

In a similar way, if we want to send data from the host computer to the device we should first send the data on the host by running

and read it on the device

How to use the mass storage function in Linux

Once the Linux gadget driver has been installed correctly we just need to mount the SD card on the device in order to get the mass storage device ready. In order to do that we just need to run the following commands on the target device:

  • Mount the MMC partition
  • On the Ubuntu PC open the external media device, now you have access to the MMC card on your device.


Using CDC ACM + MS device with Windows 7 host

When using the device on Windows, you need to use a INF file in order to load the appropriate driver. There is an INI file avaiable (see above), but it didn't workfor use on Windows 7 with a CDC ACM + MS device. Instead we used the proprietarydriver from Thesycon.

Thesycon provides a demo version of the driver[1] that can be installed on Windows.By default it creates a directory on C:ThesyconCdcAcmV1.96.0_Demo. There isan INI file and a SYS driver in the idisk sub-directory you can use to exchange USB serial datawith the target device.

In order use the INF file provided it is necessary to add the VID (Vendor ID) and PID (Product ID) of the target device to the file; look for the following piece of code into the file:

Replace the USBVID_VVVV&PID_PPPP string with the corresponding VID and PID. In addition we need to specify the interface on which the serial function is located since it is a composite device.For example, the following uses the Linux Foundation (VID = 0x1D6B) device with a PID = 0x0104(Multifunction Composite Gadget). We assume the serial interface is located in the interface 1, so the piece of code shown above should be replaced by:

where MI_01 means the serial interface is on interface 1.

Once the edited INF file is read, just plug the device to the Windows host computer. Windowswill try to locate a usable driver. When it asks for the driver just point it to the folder wherethe modified INF file resides and Windows will do the rest.


If Windows doesn't ask for it but still fails on the installation you can install the driver by:

Multifunction composite gadget driver installer
  1. Go to Start -> Control panel -> Devices and printers'
  2. Right click on the composite device.
  3. Properties -> Hardware.
  4. Select the CDC ACM Data function.
  5. Properties
  6. Change configuration
  7. Update firmware
  8. Point it to the folder containing the INF file and then wait to the driver to be installed.

Once Windows announces the driver was installed correctly, the device is ready to use.

Using the Windows 7 serial port

In order to use the serial function you can install TeraTerm on your Windows machine and launch the TeraTerm application. On first dialog TeraTerm will ask for the connection properties as is shown on figure 1, be sure to select Serial and the port corresponding to your composite device.

Figure 1. TeraTerm initial screen.

After selecting the appropriated port, TeraTerm will open the connection with the device.

To send data from the device to your host PC run the following command on the target device:

You should be able to see the text foo in the TeraTerm window.

To send data from Windows to the device write any word on your TeraTerm's window and press ENTER and then run the following command on the device:

You should be able to see the string on your target device console.

How to use the mass storage function in Windows 7

Once the Linux gadget driver has been installed correctly we just need to mount the SD card on the device in order to get the mass storage device ready. In order to do that we just need to run the following commands on the target device:

  • Mount the MMC partition
  • On the Windows PC open the external media device, now you have access to the MMC card on your device.

Mass Storage Performance Test

A 4GB file was created on the LeopardeBoard using 'dd'. The file was transmitted from a LeopardBoard to a Ubuntu PC using the USB composite driver. The transmitted file and the file at the LeopardBoard where compared using the sha1sum, both numbers where the same indicating that the USB file transfer didn't corrupted the data.

The average LeopardBoard-to-host transmission speed was approximately 3.5MB/s.

Mass storage endurance test

To keep from wearing out NAND or an SD card, we will use a VFAT file system contained in a file in tmpfs. Change VFAT_FILE to point to a file on NAND or SD card if that is your preference.

On the target, setup a 10Mbyte VFAT file system with some files and allow it to be mounted over USB:

Once the USB cable is connected to the host, your host should automount the VFAT file system and show the 3 files created.

Test host only access to USB mass storage file system with USB cable always connected

On the host, run the following endurance test:

Test host and target accessing to USB mass storage file system with USB cable always connected

For this endurance test,

  • the target will create a file and a sha1sum
  • the host will download the file and the sha1sum
  • the host will calculate the sha1sum for the downloaded file and compare it to the sha1sum calculated by the target
  • created files will be delete and the process repeated

Make sure you stop any applications running on the target that will interfere with USB serial communication. On target, update inittab and then have init reread the modified file to allow a shell to exist on USB ACM serial port.

On the host side setup so it is easy to send commands the run on the target. To keep USB ACM from sending open / close indications to the shell running on ttyGS0, I just run picocom in another window. We can still send commands to the target using /dev/ttyACM0.

Now open another terminal and send some commands to the shell running on the target. The responses to your commands will be displayed in picocom:

Create the file with the VFAT file system:

A /bin/redirect helper script is needed on the target (there may be more elegant solutions)

and allow the script to be executed

Now we have the pieces in place to write the test.

Contact Us

Visit our Main Website for the RidgeRun Products and Online Store. RidgeRun Engineering informations are available in RidgeRun Professional Services and RidgeRun Subscription Model pages. Please email to support@ridgerun.com for technical questions. Contact details for sponsoring the RidgeRun GStreamer projects are available at the Sponsor Projects page.

Multifunction Composite Gadget Driver Download

Retrieved from 'http://developer.ridgerun.com/wiki/index.php?title=How_to_use_USB_CDC_ACM_and_MS_composite_Linux_gadget_driver&oldid=31094'