Welcome to the new Linux Foundation Forum!

Linux Device Drivers

cosminbriceagcosminbriceag Posts: 3
edited September 2016 in Kernel Development

Hi guys,

Could someone explain to me what is the difference between simple char device driver and serial drivers which use the tty core? I mean, if i want to develop a char driver for a serial device and there will be a node in /dev/mydev file system, is it mandatory to use another node /dev/tty_x for the the same driver, or I can use the mydev ?

I am confused about these. In all the driver development books is presented the file_operations structure which holds the entries for the device driver, but in another chapter is presented uart_ops structure which in turn stores others entries.

Thank you,

Comments

  • saqman2060saqman2060 Posts: 777
    edited September 2016

    I am not an expert Kernel module writer but I can redirect you to information that I researched. Character devices, from what I read, are devices that transmit data from and to the user. Devices charaterized as char devices are printers, video cards, keyboards and mouses generally. 

    Serial devices were known to be communication devices for transmition of data from one location to the next in series of bytes. They can now be used by input devices since they follow the some underlyning princible, "communicate". 

    Most if not all devices are located in /dev/. The driver you want to write will be used to access a device in /dev either serially of characterly. You can either let udev name the device or give it a name you specify like /dev/mydev. A serial driver, to my understanding, handles a "serial device" does not matter how it is connected. TTYs were knoen as "teletypes" and were physical machines used to communicate with another machine until this communication method became software-based. Hopes this helps

    http://www.tldp.org/LDP/lkmpg/2.4/html/x579.html (char device drivers)

    http://www.linusakesson.net/programming/tty/ (TTYs explained)

     

  • Thank you for your answer,

    So, as far as i understood, it is possible to combine both char drivers and serial drivers ? With char driver I expose the data to the user and with the serial driver I handle the lower layer (e.g UART) ?

     

  • Hello again,

    For those who still wait for an answer, I found myself an answer.

    [ The Linux tty driver core lives right below the standard character driver level and provides a range of features focused on providing an interface for terminal style devices to use ] 

    https://static.lwn.net/images/pdf/LDD3/ch18.pdf

     

  • saqman2060saqman2060 Posts: 777
    edited September 2016

    Good job finding what you needed. So far what I read was informative. This might me understand tty'sbetter. Thanks for sharing.

Sign In or Register to comment.