Enviar pesquisa
Carregar
Character Driver Fundamentals
•
19 gostaram
•
57,258 visualizações
Título melhorado com IA
Anil Kumar Pugalia
Seguir
Tecnologia
Denunciar
Compartilhar
Denunciar
Compartilhar
1 de 22
Recomendados
Character drivers
Character drivers
pradeep_tewani
Linux device drivers
Linux device drivers
Emertxe Information Technologies Pvt Ltd
I2C Drivers
I2C Drivers
SysPlay eLearning Academy for You
Introduction to Linux Drivers
Introduction to Linux Drivers
Anil Kumar Pugalia
Block Drivers
Block Drivers
Anil Kumar Pugalia
Linux dma engine
Linux dma engine
pradeep_tewani
Platform Drivers
Platform Drivers
SysPlay eLearning Academy for You
Spi drivers
Spi drivers
pradeep_tewani
Recomendados
Character drivers
Character drivers
pradeep_tewani
Linux device drivers
Linux device drivers
Emertxe Information Technologies Pvt Ltd
I2C Drivers
I2C Drivers
SysPlay eLearning Academy for You
Introduction to Linux Drivers
Introduction to Linux Drivers
Anil Kumar Pugalia
Block Drivers
Block Drivers
Anil Kumar Pugalia
Linux dma engine
Linux dma engine
pradeep_tewani
Platform Drivers
Platform Drivers
SysPlay eLearning Academy for You
Spi drivers
Spi drivers
pradeep_tewani
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
linuxlab_conf
I2c drivers
I2c drivers
pradeep_tewani
Embedded Software Design
Embedded Software Design
Anil Kumar Pugalia
Introduction to char device driver
Introduction to char device driver
Vandana Salve
Linux Ethernet device driver
Linux Ethernet device driver
艾鍗科技
Interrupts
Interrupts
Anil Kumar Pugalia
Memory management in linux
Memory management in linux
Dr. C.V. Suresh Babu
Arm device tree and linux device drivers
Arm device tree and linux device drivers
Houcheng Lin
SPI Drivers
SPI Drivers
SysPlay eLearning Academy for You
Linux Porting
Linux Porting
Champ Yen
Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)
Emertxe Information Technologies Pvt Ltd
Kernel Process Management
Kernel Process Management
pradeep_tewani
Android Virtualization: Opportunity and Organization
Android Virtualization: Opportunity and Organization
National Cheng Kung University
Linux DMA Engine
Linux DMA Engine
SysPlay eLearning Academy for You
Processes
Processes
Anil Kumar Pugalia
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
Tushar B Kute
Understanding a kernel oops and a kernel panic
Understanding a kernel oops and a kernel panic
Joseph Lu
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
Divye Kapoor
Shell scripting
Shell scripting
Manav Prasad
Linux Device Tree
Linux Device Tree
艾鍗科技
File System Modules
File System Modules
Anil Kumar Pugalia
PCI Drivers
PCI Drivers
Anil Kumar Pugalia
Mais conteúdo relacionado
Mais procurados
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
linuxlab_conf
I2c drivers
I2c drivers
pradeep_tewani
Embedded Software Design
Embedded Software Design
Anil Kumar Pugalia
Introduction to char device driver
Introduction to char device driver
Vandana Salve
Linux Ethernet device driver
Linux Ethernet device driver
艾鍗科技
Interrupts
Interrupts
Anil Kumar Pugalia
Memory management in linux
Memory management in linux
Dr. C.V. Suresh Babu
Arm device tree and linux device drivers
Arm device tree and linux device drivers
Houcheng Lin
SPI Drivers
SPI Drivers
SysPlay eLearning Academy for You
Linux Porting
Linux Porting
Champ Yen
Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)
Emertxe Information Technologies Pvt Ltd
Kernel Process Management
Kernel Process Management
pradeep_tewani
Android Virtualization: Opportunity and Organization
Android Virtualization: Opportunity and Organization
National Cheng Kung University
Linux DMA Engine
Linux DMA Engine
SysPlay eLearning Academy for You
Processes
Processes
Anil Kumar Pugalia
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
Tushar B Kute
Understanding a kernel oops and a kernel panic
Understanding a kernel oops and a kernel panic
Joseph Lu
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
Divye Kapoor
Shell scripting
Shell scripting
Manav Prasad
Linux Device Tree
Linux Device Tree
艾鍗科技
Mais procurados
(20)
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
I2c drivers
I2c drivers
Embedded Software Design
Embedded Software Design
Introduction to char device driver
Introduction to char device driver
Linux Ethernet device driver
Linux Ethernet device driver
Interrupts
Interrupts
Memory management in linux
Memory management in linux
Arm device tree and linux device drivers
Arm device tree and linux device drivers
SPI Drivers
SPI Drivers
Linux Porting
Linux Porting
Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)
Kernel Process Management
Kernel Process Management
Android Virtualization: Opportunity and Organization
Android Virtualization: Opportunity and Organization
Linux DMA Engine
Linux DMA Engine
Processes
Processes
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
Understanding a kernel oops and a kernel panic
Understanding a kernel oops and a kernel panic
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
Shell scripting
Shell scripting
Linux Device Tree
Linux Device Tree
Destaque
File System Modules
File System Modules
Anil Kumar Pugalia
PCI Drivers
PCI Drivers
Anil Kumar Pugalia
Serial Drivers
Serial Drivers
SysPlay eLearning Academy for You
Network Drivers
Network Drivers
Anil Kumar Pugalia
Low-level Accesses
Low-level Accesses
Anil Kumar Pugalia
Video Drivers
Video Drivers
Anil Kumar Pugalia
Kernel Programming
Kernel Programming
Anil Kumar Pugalia
Audio Drivers
Audio Drivers
Anil Kumar Pugalia
USB Drivers
USB Drivers
Anil Kumar Pugalia
Linux Porting
Linux Porting
Anil Kumar Pugalia
BeagleBone Black Bootloaders
BeagleBone Black Bootloaders
SysPlay eLearning Academy for You
BeagleBoard-xM Bootloaders
BeagleBoard-xM Bootloaders
SysPlay eLearning Academy for You
Embedded C
Embedded C
Anil Kumar Pugalia
References
References
Anil Kumar Pugalia
Kernel Debugging & Profiling
Kernel Debugging & Profiling
Anil Kumar Pugalia
gcc and friends
gcc and friends
Anil Kumar Pugalia
File Systems
File Systems
Anil Kumar Pugalia
Destaque
(17)
File System Modules
File System Modules
PCI Drivers
PCI Drivers
Serial Drivers
Serial Drivers
Network Drivers
Network Drivers
Low-level Accesses
Low-level Accesses
Video Drivers
Video Drivers
Kernel Programming
Kernel Programming
Audio Drivers
Audio Drivers
USB Drivers
USB Drivers
Linux Porting
Linux Porting
BeagleBone Black Bootloaders
BeagleBone Black Bootloaders
BeagleBoard-xM Bootloaders
BeagleBoard-xM Bootloaders
Embedded C
Embedded C
References
References
Kernel Debugging & Profiling
Kernel Debugging & Profiling
gcc and friends
gcc and friends
File Systems
File Systems
Semelhante a Character Driver Fundamentals
Introduction to Linux
Introduction to Linux
Anil Kumar Pugalia
Introduction to Linux
Introduction to Linux
Anil Kumar Pugalia
Linux Network Management
Linux Network Management
Anil Kumar Pugalia
리눅스 드라이버 #2
리눅스 드라이버 #2
Sangho Park
Shell Scripting
Shell Scripting
Anil Kumar Pugalia
Introduction to Embedded Systems
Introduction to Embedded Systems
Anil Kumar Pugalia
Toolchain
Toolchain
Anil Kumar Pugalia
File System Modules
File System Modules
Anil Kumar Pugalia
Embedded Applications
Embedded Applications
Anil Kumar Pugalia
How to create your own Linux distribution (embedded-gothenburg)
How to create your own Linux distribution (embedded-gothenburg)
Dimitrios Platis
Kernel Debugging & Profiling
Kernel Debugging & Profiling
Anil Kumar Pugalia
Embedded Android
Embedded Android
晓东 杜
LSA2 - 02 Namespaces
LSA2 - 02 Namespaces
Marian Marinov
Linux Kernel Overview
Linux Kernel Overview
Anil Kumar Pugalia
Cognitive data capture with Elis - Rossum's technical webinar
Cognitive data capture with Elis - Rossum's technical webinar
Petr Baudis
1032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.2
Stanley Ho
Processes
Processes
Anil Kumar Pugalia
Linux IO
Linux IO
Liran Ben Haim
Activity 5
Activity 5
Heidi Owens
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Vincenzo Iozzo
Semelhante a Character Driver Fundamentals
(20)
Introduction to Linux
Introduction to Linux
Introduction to Linux
Introduction to Linux
Linux Network Management
Linux Network Management
리눅스 드라이버 #2
리눅스 드라이버 #2
Shell Scripting
Shell Scripting
Introduction to Embedded Systems
Introduction to Embedded Systems
Toolchain
Toolchain
File System Modules
File System Modules
Embedded Applications
Embedded Applications
How to create your own Linux distribution (embedded-gothenburg)
How to create your own Linux distribution (embedded-gothenburg)
Kernel Debugging & Profiling
Kernel Debugging & Profiling
Embedded Android
Embedded Android
LSA2 - 02 Namespaces
LSA2 - 02 Namespaces
Linux Kernel Overview
Linux Kernel Overview
Cognitive data capture with Elis - Rossum's technical webinar
Cognitive data capture with Elis - Rossum's technical webinar
1032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.2
Processes
Processes
Linux IO
Linux IO
Activity 5
Activity 5
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Mais de Anil Kumar Pugalia
System Calls
System Calls
Anil Kumar Pugalia
Playing with R L C Circuits
Playing with R L C Circuits
Anil Kumar Pugalia
Mobile Hacking using Linux Drivers
Mobile Hacking using Linux Drivers
Anil Kumar Pugalia
Functional Programming with LISP
Functional Programming with LISP
Anil Kumar Pugalia
Power of vi
Power of vi
Anil Kumar Pugalia
"make" system
"make" system
Anil Kumar Pugalia
Hardware Design for Software Hackers
Hardware Design for Software Hackers
Anil Kumar Pugalia
RPM Building
RPM Building
Anil Kumar Pugalia
Linux User Space Debugging & Profiling
Linux User Space Debugging & Profiling
Anil Kumar Pugalia
System Calls
System Calls
Anil Kumar Pugalia
Timers
Timers
Anil Kumar Pugalia
Threads
Threads
Anil Kumar Pugalia
Synchronization
Synchronization
Anil Kumar Pugalia
Signals
Signals
Anil Kumar Pugalia
Linux Memory Management
Linux Memory Management
Anil Kumar Pugalia
Linux File System
Linux File System
Anil Kumar Pugalia
Inter Process Communication
Inter Process Communication
Anil Kumar Pugalia
Mais de Anil Kumar Pugalia
(17)
System Calls
System Calls
Playing with R L C Circuits
Playing with R L C Circuits
Mobile Hacking using Linux Drivers
Mobile Hacking using Linux Drivers
Functional Programming with LISP
Functional Programming with LISP
Power of vi
Power of vi
"make" system
"make" system
Hardware Design for Software Hackers
Hardware Design for Software Hackers
RPM Building
RPM Building
Linux User Space Debugging & Profiling
Linux User Space Debugging & Profiling
System Calls
System Calls
Timers
Timers
Threads
Threads
Synchronization
Synchronization
Signals
Signals
Linux Memory Management
Linux Memory Management
Linux File System
Linux File System
Inter Process Communication
Inter Process Communication
Último
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Mark Goldstein
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
Ravi Sanghani
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
Wes McKinney
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
HarshalMandlekar2
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
LoriGlavin3
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
panagenda
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
panagenda
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
Rick Flair
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
LoriGlavin3
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
UiPathCommunity
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
Alan Dix
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Alkin Tezuysal
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
ThousandEyes
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
LoriGlavin3
2024 April Patch Tuesday
2024 April Patch Tuesday
Ivanti
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
ThousandEyes
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
Inflectra
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
Ingrid Airi González
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
LoriGlavin3
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
Hiroshi SHIBATA
Último
(20)
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
2024 April Patch Tuesday
2024 April Patch Tuesday
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
Character Driver Fundamentals
1.
© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. Character Drivers
2.
2© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. What to Expect? After this session, you would know W's of Character Drivers Major & Minor Numbers Registering & Unregistering Character Driver File Operations of a Character Driver Writing a Character Driver Linux Device Model udev & automatic device creation
3.
3© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. W's of Character Drivers What does “Character” stand for? Look at entries starting with 'c' after ls -l /dev Device File Name User Space specific Used by Applications Device File Number Kernel Space specific Used by Kernel Internals as easy for Computation
4.
4© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. Major & Minor Number ls -l /dev Major is to Category; Minor is to Device Data Structures described in Kernel C in object oriented fashion Type Header: <linux/types.h> Type: dev_t – 12 bits for major & 20 bits for minor Macro Header: <linux/kdev_t.h> MAJOR(dev_t dev) MINOR(dev_t dev) MKDEV(int major, int minor)
5.
5© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. 3 Entities in 3 Spaces Device Driver /dev/io Device Kernel Space User Space Hardware Space VFS Device File Application open()
6.
6© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. Registering & Unregistering Registering the Device Driver int register_chrdev_region(dev_t first, unsigned int count, char *name); int alloc_chrdev_region(dev_t *dev, unsigned int firstminor, unsigned int cnt, char *name); Unregistering the Device Driver void unregister_chrdev_region(dev_t first, unsigned int count); Header: <linux/fs.h> Kernel Window: /proc/devices
7.
7© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. The file operations struct file_operations struct module owner = THIS_MODULE; /* <linux/module.h> */ int (*open)(struct inode *, struct file *); int (*release)(struct inode *, struct file *); ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *); loff_t (*llseek)(struct file *, loff_t, int); int (*unlocked_ioctl)(struct file *, unsigned int, unsigned long); Header: <linux/fs.h>
8.
8© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. Initialization for Registration 1st way initialization struct cdev *my_cdev = cdev_alloc(); my_cdev->owner = THIS_MODULE; my_cdev->ops = &my_fops; 2nd way initialization struct cdev my_cdev; cdev_init(&my_cdev, &my_fops); Header: <linux/cdev.h>
9.
9© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. Registering the file operations The Registration int cdev_add(struct cdev *cdev, dev_t num, unsigned int count); The Unregistration void cdev_del(struct cdev *cdev); Header: <linux/cdev.h>
10.
10© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. The file & inode structures Important fields of struct file mode_t f_mode loff_t f_pos unsigned int f_flags struct file_operations *f_op void *private_data Important fields of struct inode unsigned int iminor(struct inode *); unsigned int imajor(struct inode *);
11.
11© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. Register/Unregister: Old Way Registering the Device Driver int register_chrdev(unsigned int major, const char *name, struct file_operations *fops); Unregistering the Device Driver int unregister_chrdev(unsigned int major, const char *name);
12.
12© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. The /dev/null read & write ssize_t my_read(struct file *f, char __user *buf, size_t cnt, loff_t *off) { ... return read_cnt; } ssize_t my_write(struct file *f, char __user *buf, size_t cnt, loff_t *off) { ... return wrote_cnt; }
13.
13© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. The read flow struct file ------------------------- f_count f_flags f_mode ------------------------- f_pos ------------------------- ... ... ssize_t my_read(struct file *f, char __user *buf, size_t cnt, loff_t *off) Buffer (in the driver) Buffer (in the application or libc) Kernel Space (Non-swappable) User Space (Swappable) copy_to_user
14.
14© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. The write flow struct file ------------------------- f_count f_flags f_mode ------------------------- f_pos ------------------------- ... ... ssize_t my_write(struct file *f, const char __user *buf, size_t cnt, loff_t *off) Buffer (in the driver) Buffer (in the application or libc) Kernel Space (Non-swappable) User Space (Swappable) copy_from_user
15.
15© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. The mem device read #include <asm/uaccess.h> ssize_t my_read(struct file *f, char __user *buf, size_t cnt, loff_t *off) { ... if (copy_to_user(buf, from, cnt) != 0) { return -EFAULT; } ... return read_cnt; }
16.
16© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. The mem device write #include <asm/uaccess.h> ssize_t my_write(struct file *f, const char __user *buf, size_t cnt, loff_t *off) { ... if (copy_from_user(to, buf, cnt) != 0) { return -EFAULT; } ... return wrote_cnt; }
17.
17© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. The I/O Control API API int (*unlocked_ioctl)(struct file *, unsigned int cmd, unsigned long arg) Command Macros _IO, _IOW, _IOR, _IOWR Parameters type (character) [15:8] number (index) [7:0] size (param type) [29:16] Header: <linux/ioctl.h> →...→ <asm-generic/ioctl.h> size [29:16] num[7:0]type[15:8] dir[31:30]
18.
18© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. Linux Device Model (LDM) struct kobject - <linux/kobject.h> kref object Pointer to kset, the parent object kobj_type, type describing the kobject kobject instantiation → sysfs representation Parent object guides the entries under /sys/ bus – the physical buses class – the device categories device – the actual devices
19.
19© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. udev & LDM Daemon: udevd Configuration: /etc/udev/udev.conf Rules: /etc/udev/rules.d/ Utility: udevinfo [-a] [-p <device_path>] Receives uevent on a change in /sys Accordingly, updates /dev &/or Performs the appropriate action for Hotplug Microcode / Firmware Download Module Autoload
20.
20© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. Device Model & Classes Latest way to create dynamic devices Create or Get the appropriate device category Create the desired device under that category Class Operations struct class *class_create(struct module *owner, char *name); void class_destroy(struct class *cl); Device into & out of Class struct class_device *device_create(struct class *cl, NULL, dev_t devnum, NULL, const char *fmt, ...); void device_destroy(struct class *cl, dev_t devnum);
21.
21© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. What all have we learnt? W's of Character Drivers Major & Minor Numbers Registering & Unregistering Character Driver File Operations of a Character Driver Writing a Character Driver Linux Device Model udev & automatic device creation
22.
22© 2010-14 SysPlay
Workshops <workshop@sysplay.in> All Rights Reserved. Any Queries?