How to use serial ports from a kernel module.
Hi guys,
I'd like to use one of the serial ports on my embedded device from a module (so I can write an input driver for the buttonpad on my PDA).
I need to be able to set the data type to 8O1 and set the port speed, and send and receive data.
Whats the proper way to do this? Ideally I'd want to prevent userspace being able to use the port which has the keypad connected, but not touch the other two ports.
Thanks,
-Ian
Quoted 9 lines · ian
I'd like to use one of the serial ports on my embedded device from a module (so I can write an input driver for the buttonpad on my PDA).
I need to be able to set the data type to 8O1 and set the port speed, and send and receive data.
Whats the proper way to do this? Ideally I'd want to prevent userspace being able to use the port which has the keypad connected, but not touch the other two ports.
You need to write a line discipline... have a look here:
http://www.linux.it/~rubini/docs/serial/serial.html
Thanks
Guennadi
---
Guennadi Liakhovetski
Quoted 2 lines · Guennadi Liakhovetski
You need to write a line discipline... have a look here:
http://www.linux.it/~rubini/docs/serial/serial.html
Hi,
Thanks for the reply!
What I cant see from that is how one can avoid touching userspace at all
- as far as I can see, only userspace can actually attach a line discipline to a serial port. I'd like to have this happen in the kernel so that I dont need some program sitting idly opening the serial device the whole time.
Thanks,
-Ian!
Quoted 8 lines · ian
Quoted 2 lines · Guennadi Liakhovetski
You need to write a line discipline... have a look here:
http://www.linux.it/~rubini/docs/serial/serial.htmlHi,
Quoted 7 lines
Thanks for the reply!
What I cant see from that is how one can avoid touching userspace at all
- as far as I can see, only userspace can actually attach a line discipline to a serial port. I'd like to have this happen in the kernel so that I dont need some program sitting idly opening the serial device the whole time.
Right, you need a user-space daemon for that. In your original post you only said
Quoted 2 lines
Quoted 2 lines
Ideally I'd want to prevent userspace being able to use the port which has the keypad connected, but not touch the other two ports.
which I understood as "I want to lock this port, and leave the rest untouched" and not as "avoid touching userspace at all". I don't think you can do it without a user-space programme.
Thanks
Guennadi
---
Guennadi Liakhovetski