-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 El 2007-01-06 a las 04:03 +0100, Octavio Ávalos escribió:
Probing for best speed to talk to modem: 38400 19200 9600 4800 2400 1200 Unable to deduce DTE-DCE speed; check that you are using the correct device and/or that your modem is setup properly. If all else fails, try the -s option to lock the speed.
Muy peculiar. Estoy mirando ese código en "/usr/sbin/faxaddmodem", a ver como lo hace. Es simple en apariencia. Busco el string "Probing for best speed", y me encuentro esto: echo "" if [ -z "$SPEED" ]; then # # Probe for the highest speed at which the modem # responds to "AT" with "OK". # printf "Probing for best speed to talk to modem:" SPEEDS=`ttySpeeds $tdev` # set of speeds for auto-bauding for SPEED in $SPEEDS do printf " $SPEED" SendToModem AT >/dev/null 2>&1 sleep 1 RESULT=`tr -ds '\015' '\012' < $OUT | $SED -n '$p'` test "$RESULT" = OK && break; done if [ "$RESULT" != OK ]; then echo "" echo "Unable to deduce DTE-DCE speed; check that you are using the" Es decir, intenta enviar el comando "OK a disintas velocidades, a ver a cual le responde. Lo peculiar es que ahí arriba no se ve como cambia la velocidad, y es que lo hace con la función del script SendToModem mediante la variable global $SPEED - y esa función no es tan simple: SendToModem() { COMMAND=$* sleep 1 # wait for previous kill case $TARGET in *-linux*) ;; *) onDev $STTY -clocal; sleep 1 ;; # reset the modem (hopefully) esac # start listening for output onDev -c "$STTY clocal && exec $CAT $tdev"; sleep 2 # # NB: eof is set to ^A so that only 1 character is needed # for a pending read on HPUX systems # onDev $STTY -echo -icrnl -ixon -ixoff -isig eof '"^A"' clocal $SPEED; sleep 1 # NB: merging \r & ATQ0 causes some modems problems printf "\r" >$tdev; sleep 1; # force consistent state printf "ATQ0V1E1\r" >$tdev; sleep 1; # enable echo and result codes for i in $COMMAND; do printf "$i\r" >$tdev; sleep 1; done kill -9 $catpid; catpid= # NB: [*&\\\\$] must have the "$" last for AIX (yech) pat=`echo "$i"|$SED -e 's/[*&\\\\$]/\\\\&/g'` # escape regex metacharacters RESPONSE=`tr -ds '\015' '\012' < $OUT | \ $SED -n "/$pat/{n;s/ *$//;p;q;}" | $SED 's/+F.*=//'` } La linea que pone la velocidad es esta: onDev $STTY -echo -icrnl -ixon -ixoff -isig eof '"^A"' clocal $SPEED; ¿Y ese "onDev", que es? Si es una función, no veo donde se define. Un comando del sistema no parece tampoco. Anda, ¡sí! ¡Es una definición variable! if [ -x ${ONDELAY} ]; then onDev() { if [ "$1" = -c ]; then shift; catpid=`${ONDELAY} $tdev $SH -c "$* >$OUT" & echo $!` else ${ONDELAY} $tdev $SH -c "$*" fi } else cat<<'EOF' The "ondelay" program to open the device without blocking is not present. We're going to try to continue without it; let's hope that the serial port won't block waiting for carrier... EOF onDev() { O sea, básicamente lo que hace onDev es: /usr/lib/fax/ondelay $tdev $SH -c "$*" Donde: tdev=`ttyDev $TTY` # TTY device to use for communication (no el fax) SH=$SCRIPT_SH # shell for use below SCRIPT_SH no lo veo. Ah, se define en "etc/setup.cache" como: SCRIPT_SH='/bin/sh' ¿Y ttyDev? Ah, en "etc/setup.modem": ttyDev() { echo /dev/$1 } Luego "tdev=`ttyDev $TTY`" es "echo /dev/$TTY". ¿y TTY? Ah, es un parámetro de entrada del script, o en blanco: SPEED= while [ x"$1" != x"" ] ; do case $1 in -s) SPEED=$2; shift;; -*) echo "Usage: $0 [-s SPEED] [ttyname]"; exit 1;; *) TTY=$1;; esac shift done ¿En blanco? Que jaleo. A ver: onDev $STTY -echo -icrnl -ixon -ixoff -isig eof '"^A"' clocal $SPEED; sleep 1 algo así: /usr/lib/fax/ondelay $tdev /bin/bash -c -echo -icrnl -ixon -ixoff -isig eof '"^A"' clocal $SPEED Que jaleo.... ¿y eso pone la velocidad del modem? ¿porqué no usa setserial? Se me ocurre que uses "faxaddmodem [-s SPEED] [ttyname]" con la velocidad que diga "setserial" que tiene puesta el modem y a freir monas. Por probar... - -- Saludos Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFFoOejtTMYHG2NR9URAqvSAJ41I9x3lvtcywLnJEbdpKsN3JNswwCfWnnE /JiXWJIx3ylXGrnzWl92plk= =KpZt -----END PGP SIGNATURE-----