Usb; Usb Host; Usb Device - GARZ&FRICKE GUF-Yocto-34.0-r5756-0-VINCELL User Manual

Embedded computer systems
Table of Contents

Advertisement

GUF-Yocto-34.0-r5756-0
struct can_frame frame;
nbytes = read(iSock, &frame, sizeof(frame));
if (nbytes > 0) {
printf("ID=0x%X DLC=%d data[0]=0x%X\n",
frame.can_id,
frame.can_dlc,
frame.data[0]);
}
Example 5 shows how a CAN message with four bytes with the standard ID 0x20 is sent on
shell, using the
tool. The CAN bus has to be physically prepared properly and there has to by at least
cansend
one other node that is configured to read on this message ID for this task. Furthermore, all nodes must have the
same bittiming.
root@vincell:~# cansend can0 -i 0x20 0xca 0xbe 0xca 0xbe
Example 6 shows how all CAN messages are read on
root@vincell:~# candump can0
A more detailled documentation of the CAN bus handling in the Linux kernel can be found in the documentation
directory of the Linux kernel source tree.

6.8 USB

There are two general types of USB devices:
Host: the Linux platform device is the host and controls several devices supported by corresponding
USB
Linux drivers
USB
Device: the Linux platform device acts as a USB device itself by emulating a specific device type
Additionally, if supported, an OTG-enabled port can automatically detect, which of the above roles the platform
plays during the plugging process.

6.8.1 USB Host

For USB Host functionality, Garz & Fricke platforms per default support the following devices:
USB Mass Storage
USB Keyboard
There are many more device drivers available in the Linux kernel. They are not activated by default, because
Garz & Fricke cannot maintain and test the huge amount of existing drivers. Instead, the customer may do this
himself or engage Garz & Fricke to implement his special use case. Existing drivers can easily be activated by
reconfiguring and rebuilding the Linux kernel inside the BSP.
The USB Host bus can also be directly accessed by using libusb. This library is installed on Garz & Fricke
platforms per default.
Further information about libusb can be found under:
I
http://libusb.sourceforge.net/api-1.0
Note: If libusb is used to access the USB bus directly, the user is responsible to keep the interoper-
ability consistent with all other USB devices that are controlled by the Linux kernel.

6.8.2 USB Device

For USB Device functionality, the following device emulations are supported per default:
30
VINCELL
User Manual
¡
¡
can0
using the
candump
can0
from the Linux
tool:

Advertisement

Table of Contents
loading

Table of Contents