Re: ldattach: struct termios

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

 



On Thu, 27 Mar 2008 14:58:50, Karel Zak wrote:
> On Thu, Mar 27, 2008 at 01:17:10AM +0100, Tilman Schmidt wrote:
>>>>>   Why we cannot use standard /usr/include/termios.h?
>> It compiles alright, but it doesn't work:
>>
>> ts@xenon:~/util-linux-ng/sys-utils> ./ldattach -s 9600 M101 /dev/ttyS0
>> ldattach: cannot get terminal attributes for /dev/ttyS0: Invalid argument
> 
>  Sure... this is completely wrong way. (Sorry, I didn't read glibc
>  termios code before.) We cannot use glibc termios for ioctl(). The glibc
>  tcsetattr() translates glibc termios to kernel termios...

Ok, so we agree on this. Good.

>> I'm not sure how to solve this:
>> - Drop the entire idea of supporting arbitrary bitrates portably? I've
>> got half a mind to do that by now.
> 
>  I don't think that we have to care about difference between termios
>  and termios2.  It's glibc job (and glibc supports the new method
>  when available).

Be that as it may. What glibc does not support, however, is the actual
benefit of the new method, namely setting arbitrary bit rates. The glibc
functions only accept speed_t values (ie. the limited set Bnnn constants
defined in asm/termbits.h) for specifying the input and output speeds.

>  My suggestion is to use standard libc functions (cfset{i,o}speed(),
>  tcsetattr() and tcgetattr()).

That is what I did initially. It earned me a request from Mike not to
"start off with a hobbled program".

Mike: what do you think? Do you see a way of getting that to work across
all platforms? Or would you consent to my falling back to the hobbled
glibc methods?

>  Is there any way how to test ldattach(8)? Do you have any simple
>  test (I don't have GIGASET_M101;-) ?

You don't need one. The LD will happily load without a device attached
and only complain afterwards if nothing responds on the line. So if you
have a kernel built with CONFIG_GIGASET_M101=m (like most current
distribution kernels I know of) or =y you can test with the GIGASET_M101
LD and watch for the syslog message:

 kernel: ser_gigaset ser_gigaset.0: Could not initialize the device.

OTOH you could just attach the default LD N_TTY with
"ldattach TTY /dev/ttyS0" and watch it do nothing.

HTH
Tilman

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux