Accessing a serial port from a linux kernel module

前端 未结 2 1120
生来不讨喜
生来不讨喜 2021-01-02 03:15

Hello Linux Kernel Driver Gurus!

I\'m writing a v4l2 driver for a camera that uses a serial interface for configuration. I\'d like the driver to configure the camer

2条回答
  •  北海茫月
    2021-01-02 03:33

    First I would advise you to find a way to do this from the userspace if possible: what you try to achieve here really is userspace code in kernel code.

    But if you don't find a way to do it, this article shows you how to do userspace calls in kernelspace.

    Since you want to access a serial port, you should have calls that tty oriented, for instance for open:

    serial_fd = sys_open("/dev/ttyS0",  O_RDWR | O_NOCTTY | O_NONBLOCK))
    

提交回复
热议问题