Reputation: 71
There is an external device (sensor keyboard) connected to processor thrue uart port (tx rx) and gpio interrupt line. Need to write driver for this keyboard (not standart own protocol, linux kernel 4.1).
I writed module whith a line discipline and requested irq on open() function (when open from user space /dev/ttymxc3). It's work, but line discipline structure has no released callbacks for suspend and resume functions.
It's need to release sleep keyboard when system is sleeping.
I try to write tty driver that use uart driver, but don't know how. How to communicate from kernel module with external devices thrue uart port?
Thanks.
Upvotes: 1
Views: 1917
Reputation: 31
// call userspace
{
mm_segment_t fs;
fs=get_fs();
set_fs(get_ds());//KERNEL DS
handle = sys_open(UTS_UART_DEV_NAME, O_RDWR | O_NOCTTY | O_NONBLOCK, 0);
if( handle < 0 )
{
printk(KERN_INFO "UTS Port Open Fail [%s] \n ", UTS_UART_DEV_NAME);
return -1;
}
set_fs(fs);
}
// call userspace
Upvotes: 2