Re: About changing Line Discipline from Kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Onsdag den 22. februar 2012 12:35:16 skrev Mayank Rana:
> 
> I have few queries related to using Line Discipline.
> 
> 1. I understand that line discipline can be changed from user space
> application by opening the device and doing ioctl with required Line
> Discipline ID. Is it possible to do the same from kernel module who
> would be communicating with that line discipline ?
> 
> 2. Is it way to set default line discipline for particular tty device
> to required Line Discipline instead of N_TTY one ?
> 
> Appreciate your help on this.

I've earlier done something like this :


        /* Attach line discipline to the uctrl tty */
        set_fs(get_ds());
        ret = put_user(N_PS3D, &ldiscNum);
        if (ret != 0) {
                PSDEBUG(debuglevel, "Leaving, EFAULT\n");
                return -EFAULT;
        } else {
                set_fs(KERNEL_DS);
                ret = uctrl_file->f_op->unlocked_ioctl(uctrl_file, TIOCSETD, (unsigned long)&ldiscNum);

                /*
                 * Decrement use count since setting the line descipline triggers a call to 'n_ps3d_tty_open'
                 * which increments the use count making it impossible to only the module without --force
                 */
                module_put(THIS_MODULE);

                if (ret < 0) {
                        PSKERR(debuglevel, "failed with n_tty_ioctl()\n");
                        return -EFAULT;
                }
        }
        set_fs(old_fs);



-- 
Søren Holm
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux