avrdude-dev
[Top][All Lists]
Advanced

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

Re: [avrdude-dev] “Not a typewriter” avrdude error on Android


From: Joerg Wunsch
Subject: Re: [avrdude-dev] “Not a typewriter” avrdude error on Android
Date: Mon, 10 Jun 2013 14:42:15 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

As Anton Smirnov wrote:

> > Frankly: I don't know.

> Can you say what is required (compile params, flags, etc..) exactly?
> I think i will have to ask for it from android engineers or smth.

It's the POSIX (“Single UNIX Specification”, SUS) API calls
tcgetattr()/tcsetattr(), in whatever way they might be implemented.

If it's really just the isatty() call but the actual calls to
tcsetattr()/tcgetattr() would work, it's certainly safe to must remove
the isatty() test.  The meaning of “terminal” is not very strictly
defined in SUS, but if a descriptor returns a failure for isatty() but
can successfully modified via tcsetattr(), this would for sure be
somewhat self-contradictional.

OTOH, dropping the isatty() check is safe: when trying to apply the
serial port operations to a non-tty descriptor, they are supposed to
fail anyway, so it's not important to check the descriptor for
belonging to a terminal device beforehand.

> > Btw., there's no real need to pass the descriptor along a socket, you
> > could as well pass it through a commandline option and just bypass the
> > open().

> Not sure that's true. AFAIK file descriptor is process-related and it means
> nothing in context of another process

If it follows the UNIX process model, file descriptors inherited
after a fork() are supposed to be the same, I think.  SUS says
(in the description of fork()):

“The child process shall have its own copy of the parent's file
descriptors. Each of the child's file descriptors shall refer to the
same open file description with the corresponding file descriptor of
the parent.”

Of course, a foreign descriptor outside of a child process makes no
sense, but inside a child process, it's supposed to work.  (File
descriptors are mandated to be small integer numbers, where “small”
refers to the requirement that each call that returns a new open
descriptor actually returns the smallest number that is not currently
open for that particular process.)

(If it doesn't follow the UNIX process model, things are of course
different.)
-- 
cheers, Joerg               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]