Introduction to Linux Device Drivers

Slides:



Advertisements
Similar presentations
Lecture 101 Lecture 10: Kernel Modules and Device Drivers ECE 412: Microcomputer Laboratory.
Advertisements

Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
CSI 400/500 Operating Systems Spring 2009 Lecture #14 – Device Management and Drivers Monday, March 23 rd, 2009.
Primary Author: Girish Verma Secondary Author(s): Navya Prabhakar Presenter: Navya Prabhakar Company/Organization: CircuitSutra USB Modeling Quick Start.
Computer System Laboratory
USERSPACE I/O Reporter: R 張凱富.
29 April 2005 Part B Final Presentation Peripheral Devices For ML310 Board Project name : Spring Semester 2005 Final Presentation Presenting : Erez Cohen.
Word Processing, Web Browsing, File Access, etc. Windows Operating System (Kernel) Window (GUI) Platform Dependent Code Virtual Memory “Swap” Block Data.
Chapter 4 Section 3.
Final presentation- Part A Avi Urman, Kobi Maltinsky Supervisor: Inna Rivkin Linux on SOPC – Embedded System Implementation.
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
TM Freescale, the Freescale logo, AltiVec, C-5, CodeTest, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of.
Operating System Program 5 I/O System DMA Device Driver.
Computer Organization Review and OS Introduction CS550 Operating Systems.
Examining Input Devices Computer Concepts Unit B.
Marcelo de Paiva Guimarães Bruno Barberi Gnecco Marcelo Knorich Zuffo
Real-time Systems Lab, Computer Science and Engineering, ASU Linux Input Systems (ESP – Fall 2014) Computer Science & Engineering Department Arizona State.
Segmentation & O/S Input/Output Chapter 4 & 5 Tuesday, April 3, 2007.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 14, 2005 Operating System.
LWIP TCP/IP Stack 김백규.
Prepared by Fareeha Lecturer DCS IIUI 1 Windows API.
ARM 7 & ARM 9 MICROCONTROLLERS AT91 1 Development Tools & Partners.
Interactive Textures as Spatial User Interfaces in X3D Web3D 2010 Symposium Sabine Webel Y. Jung, M. Olbrich, T. Drevensek, T. Franke, M.Roth, D.Fellner,
X-WindowsP.K.K.Thambi The X Window System Module 5.
MIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Lecture 4: Graphic User Interface Graphical User Interface Larry Rudolph MIT 6.893; SMA 5508 Spring 2004.
Computer Systems 1 Fundamentals of Computing
1 Lecture 6 Introduction to Process Management COP 3353 Introduction to UNIX.
Intel Open Source Technology Center Lu Baolu 2015/09
User-Space-to-Kernel Interface
CSC414 “Introduction to UNIX/ Linux” Lecture 2. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Introduction to the Linux Kernel 2.6 For The Fraser Valley Linux Users Group By Alan Bailward.
CSC190 Introduction to Computing Operating Systems and Utility Programs.
Lab 12 Department of Computer Science and Information Engineering National Taiwan University Lab12 – Driver 2014/12/16 1 /21.
Types of Software Chapter 2.
CEG 2400 FALL 2012 Linux/UNIX Network Operating Systems.
Linux Input Subsystem Multi-touch (MT) Protocol
The World Leader in High Performance Signal Processing Solutions Linux Industrial I/O Subsystem Open Platform Solutions Michael Hennerich.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
OPERATING SYSTEMS (OS) By the end of this lesson you will be able to explain: 1. What an OS is 2. The relationship between the OS & application programs.
Operating Systems Salihu Ibrahim Dasuki (PhD) CSC102 INTRODUCTION TO COMPUTER SCIENCE.
Flowcode USB Pack USB Serial – Legacy RS232 COM Port Replacement
OPERATING SYSTEMS STRUCTURES Jerry Breecher 2: Operating System Structures 1.
Identify internal hardware devices (e. g
Introduction to Operating Systems Concepts
Input / Output Chapter 9.
Linux Device Model A device model after 2.5
Homework Reading Machine Projects
Supporting Multiple Pointing Devices in Microsoft Windows
Introduction to Developing Embedded Linux Device Drivers
Chapter 6: BIOS.
Resource Management IB Computer Science.
COMP541 Input Devices: Keyboards, Mice and Joysticks
CHAPTER 5 Input Control © 2008 Cengage Learning EMEA.
Linux Kernel Module Programming
Introduction to Event-Driven Programming
Chapter 12: File System Implementation
Operating Systems (CS 340 D)
Linux Operating System Architecture
CSC461 Lecture 8: Input Devices
COMP541 Input Devices: Keyboards, Mice and Joysticks
The PCI bus (Peripheral Component Interconnect ) is the most commonly used peripheral bus on desktops and bigger computers. higher-level bus architectures.
Windows Development Dynadata Copyright, 2014 © DynaData S.A. 1/10.
Input Device Interrupt Latency of KVM on ARM using Passthrough
Introduction to Linux Device Drivers
Introduction to Linux Device Drivers
Professional Environment
Chapter-1 Computer is an advanced electronic device that takes raw data as an input from the user and processes it under the control of a set of instructions.
Chapter 13: I/O Systems.
Lecture 6 Introduction to Process Management
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

Introduction to Linux Device Drivers Class 4: Input Device Drivers with Linux Kernel Aug 7, 2014 Khem Raj

Introduction Driver Collection Supporting input devices Keyboards Mice Touchscreens Wheels …

Introduction Standardize handling of similar devices E.g. mice can be USB, bluetooth, PS/2 Standard event system to interact with userspace applications Input core extract common bits e.g. serio Name one advantage of kernel’s input subsystem ?

Input Subsystem Input device driver Input event driver Talks to the device Input event driver Talks to Applications

Input Subsystem XWin Qt GUI apps Input Devices /dev/input/* Userspace Kernel Space h/w space XWin Qt GUI apps Input Devices /dev/input/* Input Core subsystem Input Device Drivers Input Event Handers Serio USB HID HIDP PS/2 Keyboard USB Mice Bluetooth Mice

Input Events Understood by different Graphical systems e.g. X11, QT etc. H/W Independent abstraction Evdev Generic Input Event Driver

Input Event Handlers /** * struct input_value - input value representation * @type: type of value (EV_KEY, EV_ABS, etc) * @code: the value code * @value: the value */ struct input_value { __u16 type; __u16 code; __s32 value; }; What is a Input Event Driver ?

Input Device Drivers Serio Used to access keyboard controllers PS/2 mouse and keyboards, trakcpoints Serial port controllers Touch pads Using serio via callback serio_register_driver() sends cmds to controllers To Add new driver Define open, close, start, stop, etc. Use serio_register_port ()

Application/emulates mouse moves Example Console/gpm server Application/emulates mouse moves /dev/input/event0 Dispatch coordinates through sysfs (/sys/device/..) evdev Virtual Mouse Driver Input core

Application Opens a sysfs node Generate random relative coordinates open("/sys/devices/platform/vms/coordinates", O_RDWR) Generate random relative coordinates Write it down to device file descriptor Close the file descriptor

Mouse Driver Defines a struct input_dev – Input device Defines platform_device – Device struct Initialization Register a platform device and allocate struct input_dev platform_device_register_simple and input_allocate_device Create a sysfs node to read simulated coordinates sysfs_create_group(..) Define what data it will generate ( coordinates ) Use set_bit () to set members in input_dev struct e.g. evbit set_bit(REL_X, …) set_bit(REL_Y, …) Register with the input subsystem input_register_device () Write Function Gets the buffer with coordinates Use input_report_rel () to generate events ( REL_X, REL_Y) input_sync () denotes completions of events

Mouse Driver Attach to sysfs write function DEVICE_ATTR(<devicename>, 0644, NULL, <driver write function>); Define attribute group and descriptor Exit/Cleanup Unregister from input subsystem input_unregister_device () Clean sysfs node sysfs_remove_group () Unregister Driver platform_device_unregister () How does device driver write function gets registered with sysfs ?

Input Subsystem Creates evdev structure from events Send it on /dev/input/eventX gpm receives event in input_event format gpm -m /dev/input/eventX -t evdev

Evdev Interface This driver uses generic evdev interface Some devices define own Event drivers They populate input_handler struct Register input_register_handler(&mousedev_handler); Which structure is initialized to define event driver ?

Output Events Keyboard/mice LEDs and Sound beeps Set by evbits and callback function See drivers/input/misc/pcspkr.c Callback - static int pcspkr_event () static int __devinit pcspkr_probe () Declared evbits pcspkr_dev->evbit[0] = BIT(EV_SND); pcspkr_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); /* The Callback routine */ pcspkr_dev->event = pcspkr_event;

Debugging Input Drivers Use evbug module Dumps type, code and value (input_event struct) Output looks like /* Touchpad Movement */ evbug.c Event. Dev: isa0060/serio1/input0: Type: 3, Code: 28, Value: 0 How do you debug input drivers ?

Source Event handlers Device drivers reside close to subsystem code drivers/input directory But keyboard driver is in drivers/char Device drivers reside close to subsystem code net/bluetooth Documentation/input describes some of input interfaces Most of interfaces in include/linux/input.h

Thanks Q & A