Saturday, August 9, 2014

Lab - character device driver

In this lab you'll create a character device driver
you'll change the clipboard driver to support 2 devices and to allocate major number statically

Test for the complete driver:

# mknod /dev/clip1 c 237 0
# mknod /dev/clip2 c 237 1


# insmod chardrvex.ko
# echo "abc" > /dev/clip1
# echo "xyz" > /dev/clip2
# cat /dev/clip1
value=abc
# cat /dev/clip2
value=xyz

Instructions

  • Start with charDrvEx module
  • change the init function:
    • allocate another buffer for the second instance
    • change the major number allocation to static (237,0) , (237,1)
  • change the read,write operations to use the correct buffer 
  • complete exit function implementation 
  • test your work
  • write a user space application to test your work

No comments:

Post a Comment