>> >>>> Hi,
>> >>>>
>> >>>> I'm getting a 22 errno from tcsetattr() on 7-STABLE i386 in code which
>> >>>> was working under 7-STABLE amd64. Serial device is a ucom (silabs
>> >>>> cp2103). Permissions on /dev/cuaU0 look fine. Cutecom/Minicom
>> >>>> appears to open the port without error...
>> >>> I don't see anything obviously wrong, but I'd bet a bug related to
>> >>> 32/64-bit types. Can you post a complete piece of code that can be
>> >>> compiled and run and demonstrates the problem? Also, try compiling with
>> >>> -Wall -W and investigate any warnings that are produced.
>> >>>
>> >>> By the way, errno 22 is EINVAL, "Invalid argument". perror() is your
>> >>> friend.
>> >> Strange freebsd doesnt document error numbers. On POSIX, errno 22 is
>> >> EINVAL as well (documented in errno(3)). Is this applicable to freebsd?
>> >
>> > /usr/include/errno.h isn't documentation of error numbers?


> If you're wanting to track down how/why tcsetattr(3) results in EINVAL,
> using truss or ktrace might come in handy. Otherwise, you literally
> will have to throw some debugging code into the ucom(4) driver to
> try and figure out what function is kicking out code 22.

Wow! truss is quite handy.

I've located the problem, and am posting it for posterity:

Someone was memset()'ing the termios struct to zero's, then setting
the baudrate (setcfspeed) and a couple other things. Apparently this
was not a canonical set of required members of the struct, because
adding a tcgetattr(f, termio) right after the memset apparently
pre-populated the thing correctly and now it works fine...

Thanks for the leg up, Jeremy.

freebsd-hackers@freebsd.org mailing list
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"