Do More With Less. On Driver-less Interfacing with Embedded Devices. Peter Korsgaard <peter@korsgaard.com>

Similar documents
Useful USB Gadgets on Linux

Ways to Use USB in Embedded Systems

Learning USB by Doing.

USB 2.0 Flash Drive User Manual

Atmel AVR4921: ASF - USB Device Stack Differences between ASF V1 and V2. 8-bit Atmel Microcontrollers. Application Note. Features.

DEVICE DRIVERS AND TERRUPTS SERVICE MECHANISM Lesson-14: Device types, Physical and Virtual device functions

Cloudvue Remote Desktop Client GUI User Guide

Enterprise Erase LAN

smxusbd USB Device Stack

AT89C5131A Starter Kit... Software User Guide

AN249 HUMAN INTERFACE DEVICE TUTORIAL. Relevant Devices This application note applies to all Silicon Labs USB MCUs. 1.

HotelTV. Client Software Update REV A0.10 D October. Web : Mail : support@vestek.com.tr Tel :

An Analysis of Wireless Device Implementations on Universal Serial Bus

SecureLinx Spider Duo Quick Start Guide

HotelTV1. Client Software Update REV A0.6 D October. Web : Mail : support@vestek.com.tr Tel :

The care and feeding of Pythons at the Redmond Zoo. (Using Micro Python and pyboard with Windows)

[HOW TO RECOVER AN INFINITI/EVOLUTION MODEM IDX ] 1

USB Debugging and Profiling Techniques. Kishon Vijay Abraham I and Basak Partha

Embedded Linux Platform Developer

UM1734 User manual. STM32Cube USB device library. Introduction

An introduction to nxpusblib. March 2012

Bluetooth HID Profile

NetPoint Configuration Guide. for thin clients

IP Interface for the Somfy Digital Network (SDN) & RS485 URTSII

If anything is damaged or missing, contact your dealer.

Addonics T E C H N O L O G I E S. NAS Adapter. Model: NASU Key Features

Hi-Speed USB 2.0 Flash Disk. User s Manual

Feature Check. elux Operating Systems. Feature Check

Introducing the Adafruit Bluefruit LE Sniffer

Why Use ThinManager to Manage Thin Clients? White Paper. For more information, please visit:

AVR287: USB Host HID and Mass Storage Demonstration. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Configuring and Using AMT on TS140 and TS440

Chapter 2. Basic Concepts Linux Workstation. 2.1 Types of Hosts

Fall Lecture 1. Operating Systems: Configuration & Use CIS345. Introduction to Operating Systems. Mostafa Z. Ali. mzali@just.edu.

The Linux Kernel Device Model

Embedded Linux development training 4 days session

Option nv, Gaston Geenslaan 14, B-3001 Leuven Tel Fax Page 1 of 14

Getting Started with Tizen SDK : How to develop a Web app. Hong Gyungpyo 洪 競 杓 Samsung Electronics Co., Ltd

MyUSBOnly User Guide Menu

Audio Help for Webinar Attendees. GoToWebinar User Guide. Virtual Operating System (VMware, Parallels, etc.)

Gigabyte Management Console User s Guide (For ASPEED AST 2400 Chipset)

BASIC INSTRUCTIONS TO CONFIGURE ZYXEL P8701T CPE USING THE WEB INTERFACE

Ultra Thin Client TC-401 TC-402. Users s Guide

Lexia Network Installation Instructions

UniKey Family 0. UniKey Time

HP BUSINESS NOTEBOOK PC F10 SETUP OVERVIEW

Installing the Operating System or Hypervisor

Encrypting a USB Drive Using TrueCrypt

VMware View 4 with PCoIP I N F O R M AT I O N G U I D E

HP Z220, Z420, Z620, and Z820 Workstations Microsoft Windows XP Installation Reference Guide

FileCruiser. VA2600 SR1 Quick Configuration Guide

The Leading KVM Switch Solutions Provider, ATEN. 40-Port KVM Over the NET - 1 local / 4 remote user access

Stefan Schmidt. LinuxTag

ASTi PC ver Windows 7 Installation Guide. Document: DOC-01-PCVW7-IG-1

Controlling LifeSize Video Systems from the CLI

Windows MultiPoint Server 2011 Deployment Guide. Document Version 1.0 March 2011

Phone: Fax: Web: info@ctiautomation.net

ITG Software Engineering

Vidyo Desktop User Guide. Telemedicine Development Center of Asia April 2011

Virtualization and Other Tricks.

The Virtual Environment

TivaWare USB Library USER S GUIDE SW-TM4C-USBL-UG Copyright Texas Instruments Incorporated

HP ThinPro. Table of contents. USB Manager. Technical white paper

USB Card Reader Interface User Manual

Operating System Installation Guidelines

EXPLORING LINUX KERNEL: THE EASY WAY!

User s Manual. Copyright 2010 Vantec Thermal Technologies. All Rights Reserved.

rs-ba1 remote control software quick reference guide

About Parallels Desktop 10 for Mac

SPICE and desktop virtualization

ThinLinX TLXOS 64-bit Firmware Installation Guide for the Intel NUC Range. Materials Required

YubiKey Integration for Full Disk Encryption

Imation Clip USB 2.0 Flash Drive. Imation Drive Manager Software. User s Manual

Configuring Windows 7 64 bit for AutoVISION

Classroom Capture Admin Guide & Instructor Guide

Using PCoIP Zero Clients with PCoIP Host Cards

Automating the deployment of FreeBSD & PC-BSD systems. BSDCan Kris Moore PC-BSD / ixsystems kris@pcbsd.org

Keyspan:USB Serial Adapter for Mac OS X-v2.x User Manual. Table of Contents

4-1-4 Serial ATA SATA. A. Intel ICH8R (1) SATA (1) SATA (2) BIOS SATA (3) RAID BIOS RAID (4) SATA (5) SATA

Controlling EIB/KNX devices from Linux using USB

Survey of Filesystems for Embedded Linux. Presented by Gene Sally CELF

Procedure: You can find the problem sheet on Drive D: of the lab PCs. Part 1: Router & Switch

System administration basics

3. USB FLASH DRIVE PREPARATION. Almost all current PC firmware permits booting from a USB drive, allowing the launch

USB Flash Drive User s Manual

Stand Alone Type. Digital Video Recorder USER S MANUAL. (Real time recording 8 & 16 CH DVR) Revision Date :

WD My Cloud EX4 Personal Cloud Storage Release Notes for Firmware

CT LANforge-FIRE VoIP Call Generator

Serial ATA ( ULi M1573)... 2

Quick start to evaluating HP Windows Embedded Standard 2009 Thin Clients. HP t5630w, HP t5730w, HP t5740, HP gt7720

Application Note. 8-bit Microcontrollers. AVR270: USB Mouse Demonstration

Managing Devices. Lesson 5

H ARDWARE C ONSIDERATIONS

Fastboot Techniques for x86 Architectures. Marcus Bortel Field Application Engineer QNX Software Systems

Design Considerations in Adding USB Communications to Embedded Applications

Transcription:

Do More With Less On Driver-less Interfacing with Embedded Devices Peter Korsgaard <peter@korsgaard.com>

NSLU2-Linux Peter Korsgaard

Driver-less Interfacing?

Interfacing without having to install any custom SW on PC

Embedded == Custom Stuff

Embedded == Custom Stuff But Why?

.. Its

.. Its.. At First

Time Pressure

Flexibility

I'm Special

Does It Need To Be So? While these are sometimes valid concerns, often standard interfaces can be used instead Work done with Fabien Chouteau

Primer

Host Devices

Device Configuration (mode) Interface (functionality) Endpoint (pipe)

A device with multiple interfaces is called a composite device

Functions can implement Specific vendor protocols (custom) USB class protocols (standard)

Class protocols most interesting as OS'es have built in drivers HID (keyboard/mouse/..) Storage (Hard drivers, USB sticks) Audio (headsets, speakers) Video (webcams)..

Linux USB Gadget Stack User Space Other Kernel Subsystems USB Function Driver USB Function Driver Composite USB Peripheral Controller Driver

Examples

Function Keys Display with function keys used to control PC

Issues Historically interfaced to PC using custom serial protocol Custom PC SW needed Support issues Not usable during BIOS/BOOT New PCs lack serial

Solution Emulate USB HID keyboard

Human Interface Devices Class HID descriptors to specify device type and supported report (message) formats Reports to device to set properties (E.G LEDs on keyboard) On control endpoint Reports from device to report changes (E.G. key presses / releases) On interrupt endpoint

HID Keyboard (Boot) Protocol 1 byte reports to device Bitmask of LED states (numlock, capslock,..) 8 byte reports from device Modifier key mask (alt, ctrl,..) and currently pressed keys See HID usage tables for key code definitions

Implementation HID gadget function driver Mainline since 2.6.35 Split kernel / user space implementation HID descriptor handling in kernel, /dev/hidgx character device to get/set HID reports See Documentation/usb/gadget_hid.txt for details

Kernel Side Platform device in platform code defining HID device descriptor(s) Can emulate as many devices as controller has endpoints g_hid USB gadget driver

Kernel Side static struct hidg_func_descriptor hid_data = {.subclass = 0, /* No subclass */.protocol = 1, /* Keyboard */.report_length = 8,.report_desc_length = 63,.report_desc = { 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */ 0x09, 0x06, /* USAGE (Keyboard) */ 0xa1, 0x01, /* COLLECTION (Application) */... } }; static struct platform_device hid = {.name = "hidg",.id = 0,.num_resources = 0,.resource = 0,.dev.platform_data = &hid_data, }; platform_device_register(&hid);

User Space Side Read/write to /dev/hidgx E.G. To send 'a': echo -en '\0\0\4\0\0\0\0\0' >/dev/hidg0 echo -en '\0\0\0\0\0\0\0\0' >/dev/hidg0

Demo

Similar Setups Yubico UbiKey one-time password generator ThinkGeek Phantom Keystroker

Potential Pitfalls Key codes in HID reports are scancodes Corresponding key depends on PC keyboard layout

Example 2

Data Transfers Firmware Upgrades through USB

Issues Historically using custom serial protocol Custom PC SW needed Support issues New PCs lack serial

Solution Emulate USB memory stick Alternatively access USB stick if host port available

Pitfalls Mass Storage == Block device Filesystems / OSes don't support concurrent access Need to detect when it is safe to access device

Use Case Provide virtual drive where firmware upgrade can be copied to Perform upgrade when unplugged

Use Case Provide virtual drive where firmware upgrade can be copied to Perform upgrade when unplugged

Use Case Provide virtual drive where firmware upgrade can be copied to Perform upgrade when unplugged

Implementation File storage gadget function driver in kernel Userspace notification on unplug / eject Mainline since 2.6.35 Sysfs attributes: /sys/<gadget>/suspended /sys/<gadget>/lunx/file

Implementation User space program that on unplug / eject: Ejects file Loopback mounts filesystem Inspects it for interesting files Recreates file system Adds file to file storage driver

Implementation File system could simply be a pregenerated template Prepopulated with any needed help/documentation files Stored on local storage or RAM (tmpfs) If tmpfs, sparse file interesting FAT table / help file << filesystem size

Demo Check for image files Show on framebuffer

Similar Setups Same approach could be used to transfer data from device Several 3G modems have Windows drivers on emulated USB drive

Alternatives Device Firmware Upgrade (DFU) Picture Transfer Protocol (PTP) Gadgetfs implementation: http://git.denx.de/?p=ptp-gadget.git Media Transfer Protocol (MTP) MeeGo implementation: http://wiki.meego.com/buteo/mtp None are as generic or well supported

Web Interfaces Good Alternative to custom PC GUI Software Many open source libraries exists JQuery UI (GUI Widgets) Flot (Graphs).. Modern AJAX is nice for embedded Heavy processing on client side

Conclusion USB Class protocols can be (ab)used for driver-less interfacing Easiest PC SW support is NO SW Easy to integrate, in mainline Extends to lots of other areas

Thanks! Questions?