NEWAUX-handler System handler 4-Feb-94 Newaux-handler 1.33 4-Feb-94 By Pasi Ojala albert@cs.tut.fi ----------------------------- the original aux-handler by Stewe Drew This handler can be used with any serial device and unit. Now you can also handle several simultaneous serial connections at the same time with only one invokation of the handler. (If it doesn't work, let me know.) MOUNTLIST An example mountlist entry for pre-2.1 systems: NEWAUX: Handler = AXsh:bin/NEWAux-Handler Stacksize = 2000 Priority = 5 GlobVec = 1 # For after-2.1 systems you use file Devs:DosDrivers/NEWAUX: Handler = L:NEWAux-Handler Stacksize = 2000 Priority = 5 GlobVec = 1 If you have your AXsh system assigned somewhere instead of using a disk labeled AXsh:, you should copy the handler file to L: and change the mountlist entry accordingly. Newaux-handler uses about 560 bytes of stack. The rest is just to be sure about the library routines. You can try to reduce the stack to 1000 bytes or less if you REALLY REALLY are short of memory. CONTROLLING The handler can be controlled and configured with the filename part of the 'filename'. :[//]] The handler name can be any legal name, for example the default newaux. By default the handler uses serial.device unit 0, in raw-mode with 7WIRE (CTS/RTS) handshaking and in exclusive mode. NEWAUX: normally uses the speed defined in serial preferences, whichever the device defaults to. Now it is also possible to set the speed with the speed-entry. If any of the optional parameters need to be changed, you also need to specify the device name and unit number. The optional parameters include: Default Alternative Function ------- ----------- -------- raw Select raw mode, no echo con Select cooked mode, echo chars [Most programs handle changing from/to raw/cooked mode themselves.] exclusive Open serial in exclusive mode shared Open serial in shared mode 7wire Select hardware flow control (cts/rts) noflow Select no flow control speed Set the baud rate, otherwise prefs value used checkcd Send Break signal & EOF if carrier is lost Always use this in 'normal' AXsh operation. useodu Uses owndevunit.library to lock the serial [Will have no effect if OwnDevUnit.library is not available.] An example to use with UUCP getty (with no handshake): newshell newaux:serial.device/0/noflow/shared/checkcd/useodu \ from axsh:etc/remote-startup SPECIAL 'FILENAMES' The handler also has two special functions (hacks?) : newaux:tobuf/ will insert the text directly to the th receive buffer. is the connection number, that can not be obtained anywhere. You just have to guess it. The first connection is channel 0. newaux:break will send SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D to the process reading the channel. The channel number is obtained by educated guess.. newaux:led will change the state of the power led for each event in the mask. The mask values are: #define LED_SYNCREAD 1 #define LED_ASYNCREAD 2 #define LED_SYNCWRITE 4 #define LED_ASYNCWRITE 8 #define LED_QUERY 16 #define LED_MESSAGE 32 Synchronous reads are performed if there already is something in the serial buffer (in raw mode the data also needs to be requested). Synchronous writes are bad because during them other connections can't be serviced. They should only happen when the output buffer overflows (in console-mode). Asynchronous write means that the data is sent to the serial device and during the time it takes to send it the handler is free to service other connections or read requests. Asynchronous reads are started in console mode (so that line editing is possible) and in raw mode when there is no characters in the buffer(s) and a program wants to Read() (or WaitForChar()). Read is returned when a character is received or carrier is dropped, WaitForChar also if the specified timeout is reached before any characters are received. Queries are performed to find out whether the carrier has dropped or not. LED_MESSAGE lights the led for the duration of the handling of each AmigaDOS packet. Trying to open these 'files' will always fail, but the function will be performed anyway (if the handler is mounted and functioning). e.g. echo >newaux:led8 CARRIER CHECKING If the carrier checking is enabled (/checkcd) and the carrier is lost, all pending Read()'s or WaitForChar()'s are returned immediately. Read() returns 0 (zero) meaning EOF (end of input actually), WaitForChar() returns TRUE, so that your next Read() can return EOF. In addition, the Read()'ing process is signaled with SIGBREAKF_CTRL_C. HANDLER MODES (SetMode(), ACTION_SCREENMODE) Newaux-handler supports normal 'console' ('cooked') mode and 'raw' mode. SetMode(0) put the handler into console (line-)buffered mode SetMode(1) SetMode(-1) put the handler into raw mode, where line-feeds (\n) are converted to LF/CR sequences (\n\r) Also, CSI (0x9b) is converted to the more familiar ANSI/VT100 version, ESC[ (0x1b + '['). SetMode(3) is for 'passthrough' mode, no codes are translated This is well-suited for XPR transfers (see XPR). ^C and ^D cause corresponding signals to be sent to the original opener in all modes AFTER THE FIRST SetMode() CALL. This makes it impossible to break e.g. the newshell command/script that is used to start the program. When someone tells me the arguments for the ACTION_CHANGE_SIGNAL DOS-packet, I can make it work 'correctly' so that the it is possible to 'redirect' the signals to any process that wants to get them. Some notes: The raw mode input is greatly enhanced compared to axaux-handler and this affects mostly uploads to the system. The cps has gone up from 900 to the full 1090 that my modem can achieve (LhA packets) and the system load has decreased considerably. I also tested it with a Unix-executable file and got something like 1870 cps for a 131-kilobyte-file. Just like before: the more system load, the less overhead the handler will add ..