Am 08.02.2008 05:01 schrieb Mike Frysinger:
while i havent actually tested this, it should be fine. termios2 was created because not all arches integrated the speed fields into the termios structure. for those that did, there was no need for termios2. until these details get pushed into the libc, the code in ldattach prob needs to look something like: #ifndef TCGETS2 #define termios2 termios #define TCGETS2 TCGETS #define TCSETS2 TCSETS #endif ... #ifdef BOTHER < do BOTHER / CBAUD stuff > if (ioctl( TCGETS ) works) return; #endif < normal speed functions > this way you can build a binary against newer headers but have it work OK on older kernels where TCGETS2 isnt implemented
I'm afraid this isn't going to work on platforms which *did* integrate the speed fields into the termios structure, as there is no way to determine whether the retrieved termios structure does or doesn't contain the speed fields. I therefore solved it the other way around, by using the old speed setting via Bnnn for those speeds supported by it, and resorting to the BOTHER mechanism only for speed values which don't have a Bnnn value.
actually, it'd probably be best if this were a lib func in like lib/tty_speed.c or something ...
Appealing as this appears, I decided against it, because the interface would have depended on whether struct termios2 existed, and I found no aesthetically pleasing expression for that. Thanks, Tilman -- Tilman Schmidt E-Mail: tilman@xxxxxxx Bonn, Germany Diese Nachricht besteht zu 100% aus wiederverwerteten Bits. Ungeöffnet mindestens haltbar bis: (siehe Rückseite)
Attachment:
signature.asc
Description: OpenPGP digital signature