Line Discipline or Termios lacks ?

Brett Swimley brett.swimley at aedinc.net
Thu Sep 18 16:00:30 UTC 2003



Joel Sherrill wrote:

> Thomas Doerfler wrote:
>
>> Hi,
>>
>>
>>> Ok, I want to do this !! :-) But I don't found how
>>> termios_ioctl will call my private driver ioctl
>>> function.
>>>
>>> Termios_icotl have a switch(command) :
>>> case KnwonCommand1 :
>>> case KnwonCommand2 :
>>> case KnwonCommand3 :
>>> default : Call line discipline ioctl function
>>
>>
>>
>> Well, I would not change the termios code, but intercept the ioctl 
>> call in your private driver. 
>
>
> Nice suggestion.  Would you mind making it a subsection of
> the BSP and Device Driver chapter on serial devices?
>
> Also I have searched a bit and not managaed to find a standard
> way of doing this function.  If there is a way on *BSD or Linux
> to do this, it would be nice to use those names for the IOCTLS
> and possibly add them to the standard list. 

I researched this a ways back and think I discarded my notes.  I just 
did a quick search and found that Linux accomplishes this through the 
TIOCMGET and TIOCMSET ioctls.  IIRC, this is what I found way back 
when.  Don't know if *BSD has similar functionality.

>
>> Whenever an application performs an ioctl call for a specific device, 
>> then the RTEMS io system calls the "ioctl" function in the device 
>> driver (e.g. "console_ioctl"). A "nomal" driver supporting "termios" 
>> will only hand through that call to termios_ioctl, in that case the 
>> drivers "ioctl" function looks like:
>>
>>
>>
>> /*
>>  * Handle ioctl request.
>>  */
>> rtems_device_driver console_control(
>>   rtems_device_major_number major,
>>   rtems_device_minor_number minor,
>>   void                    * arg
>> )
>> {   return rtems_termios_ioctl (arg);
>> }
>>
>> In your case, you should intercept your own ioctl code in this 
>> function, so you would change it to:
>>
>> /*
>>  * Handle ioctl request.
>>  */
>> rtems_device_driver console_control(
>>   rtems_device_major_number major,
>>   rtems_device_minor_number minor,
>>   void                    * arg
>> )
>> {   rtems_status_code rc;
>>   rtems_libio_ioctl_args_t *args = arg;
>>
>>   switch(args->command) {
>>     case_MY_IOCTL_CODE_TO_ENABLE_RTS:
>>       rc = console_enable_rts(arg);
>>       break;
>>     case_MY_IOCTL_CODE_TO_DISABLE_RTS:
>>       rc = console_disable_rts(arg);
>>       break;
>>     default:       rc = rtems_termios_ioctl (arg);
>>       break;
>>   }
>>   return rc;
>> }
>>
>>
>> Does this help a bit?
>>
>> wkr,
>>     Thomas.
>>
>>
>>
>>> So How can I do, that's what I don't understand and
>>> found a solution to do this and use termios ?
>>>
>>>
>>>> wkr,
>>>>     Thomas.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> =====
>>> AUBERT Cedric
>>> SDEL Controle Commande
>>> rue Nungesser & Coli
>>> 44860 St Aignan de Grand Lieu
>>>
>>> E-mail : cedric_aubert at yahoo.fr
>>> Http : http://www.controle-commande.sdel.fr/
>>>
>>> __________________________________
>>> Do you Yahoo!?
>>> Yahoo! SiteBuilder - Free, easy-to-use web site design software
>>> http://sitebuilder.yahoo.com
>>
>>
>>
>> --------------------------------------------
>> IMD Ingenieurbuero fuer Microcomputertechnik
>> Thomas Doerfler           Herbststrasse 8
>> D-82178 Puchheim          Germany
>> email:    Thomas.Doerfler at imd-systems.de
>> PGP public key available at: http://www.imd-
>> systems.de/pgp_keys.htm
>>
>
>

-- 
Brett Swimley
Advanced Electronic Designs
brett.swimley at aedinc.net
ph: 406-585-8892 fax: 406-585-8893






More information about the users mailing list