HI
Driven by my needs , i need to toggle only the flow control (RTS, CTS) bits and have nothing to do with the rest of the functionality (e.g. normaltx , rx operation).
I am presuming that there exists a line discipline from user space for toggling RTS as
ioctl (*file, cmd, *unsigned long )
can be used easily to toggle RTS.
However, the use of IOCTL in kernel space for the same purpose brings about no change on RTS (oscilloscope shows no change).
google led me to this
http://www.archivum.info/linux-kerne...dling-RTS.html
and according to that i should make changes directly in the driver.
Can some one give me some more pointers on that? i actually have not seen the serial driver from inside and am hoping if there do exists some other work around so any pointers will be appreciated.
The snippet of my module which tries to toggle the pin in kernel is attached for pointing to possible mistakes
thx
Code:
int x=0;
int actual_module()
{ int k;
mm_segment_t oldfs;
f=filp_open("/dev/ttyUSB0",O_RDWR | O_NDELAY,0);
if ((IS_ERR(f)))
{printk("device open fail \n");
return 1;
}
f->f_pos=0;
oldfs=get_fs();
set_fs(KERNEL_DS);
tty=(struct tty_struct*)f->private_data;
x |= TIOCM_RTS;
//f->f_op->ioctl(f->f_dentry->d_inode, f, TIOCMSET, (unsigned long)&x);
k=tty->driver->ops->ioctl(tty, f,TIOCMSET, (unsigned long)&x);
printk("return value is %d \n", k);
mdelay(1000);
x &= ~TIOCM_RTS;
set_fs(oldfs);
return 0;
}