values of sys.platform? for a serial port lib

Henrik Motakef henrik at moskau.hmotakef.homeip.net
Sat Dec 29 16:19:55 EST 2001


Chris Liechti <cliechti at gmx.net> writes:

> i'm interested in values for "sys.platform" and, if possible, the name of 
> the serial port (an how the ports are numbered ttyS0, ttyS1 etc.)
> e.g "linux2" and "/dev/ttyS%d" % port, numbering starting at zero.

I don't really know where sys.platform is defined (I ended up with a
"grep -r "PLATFORM" * in the source tree, resulting in a line
"Makefile.pre.in: $(CC) -c $(CFLAGS) -DPLATFORM='"$(MACHDEP)"'...", so I
think it's defined by autoconf/automake; maybe that helps...), but FYI:

# python -c "import sys; print sys.platform"
openbsd3
# ls /dev/tty*
/dev/tty     /dev/ttyC5   /dev/ttyc2   /dev/ttyp4   /dev/ttype   /dev/ttyq8
/dev/tty00   /dev/ttyC6   /dev/ttyc3   /dev/ttyp5   /dev/ttypf   /dev/ttyq9
/dev/tty01   /dev/ttyC7   /dev/ttyc4   /dev/ttyp6   /dev/ttyq0   /dev/ttyqa
/dev/tty02   /dev/ttyC8   /dev/ttyc5   /dev/ttyp7   /dev/ttyq1   /dev/ttyqb
/dev/tty03   /dev/ttyC9   /dev/ttyc6   /dev/ttyp8   /dev/ttyq2   /dev/ttyqc
/dev/ttyC0   /dev/ttyCa   /dev/ttyc7   /dev/ttyp9   /dev/ttyq3   /dev/ttyqd
/dev/ttyC1   /dev/ttyCb   /dev/ttyp0   /dev/ttypa   /dev/ttyq4   /dev/ttyqe
/dev/ttyC2   /dev/ttyCcfg /dev/ttyp1   /dev/ttypb   /dev/ttyq5   /dev/ttyqf
/dev/ttyC3   /dev/ttyc0   /dev/ttyp2   /dev/ttypc   /dev/ttyq6
/dev/ttyC4   /dev/ttyc1   /dev/ttyp3   /dev/ttypd   /dev/ttyq7
# w
 9:18PM  up 16:54, 5 users, load averages: 1.17, 1.24, 1.23
USER    TTY FROM              LOGIN@  IDLE WHAT
henrik   C0 -                 4:24AM     0 xemacs http.ml 
henrik   p2 :0.0              8:04PM  1:06 gimp devel/yeah/docs/request_process

hth
Henrik



More information about the Python-list mailing list