This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
guides:virtual_modem:script [2019-02-18 01:29] omolini |
guides:virtual_modem:script [2019-02-18 02:16] omolini |
||
---|---|---|---|
Line 3: | Line 3: | ||
===== vmodem.sh ===== | ===== vmodem.sh ===== | ||
- | The main script. This script will open the serial port for communication and execute the dialled number as a linux script. So if you dial ATD12345, the script will look for a file 12345.sh in the working directory and execute it and output contents to serial console. | + | The main script. This script will simulate a modem by answering to standard Hayes commands. |
+ | It will open the serial port for communication and execute the dialed number as a linux script. | ||
+ | For example, if you issue the command ATD12345, the script will look for a file 12345.sh in | ||
+ | the working directory and execute it and output contents to console. | ||
- | This script can be run standalone, or with the accompanying T1.sh and ppp.sh scripts, which will enable point-to-point serial to ethernet connections. | + | This script can be run standalone, or with the accompanying T1.sh and ppp.sh scripts, which will |
+ | enable point-to-point serial to ethernet connections. | ||
<code bash vmodem.sh> | <code bash vmodem.sh> | ||
Line 354: | Line 358: | ||
printf "\nPPP link terminated.\n" | printf "\nPPP link terminated.\n" | ||
+ | </code> | ||
+ | |||
+ | ===== 2.sh ===== | ||
+ | This example script demonstrates how easy it is to make simple dial-up services, such as BBS's. To call this script, from the serial console, type "ATD2". | ||
+ | |||
+ | <code bash 2.sh> | ||
+ | #!/bin/bash | ||
+ | # | ||
+ | |||
+ | echo "Hello World Demo Box!" | ||
+ | echo "---------------------" | ||
+ | echo | ||
+ | echo "You have just successfully dialled this virtual box!" | ||
+ | echo | ||
+ | echo "Please enter your name: " | ||
+ | read username | ||
+ | echo | ||
+ | echo "Welcome $username!" | ||
+ | echo "Thank you for visiting! Bye!" | ||
+ | sleep 2 | ||
</code> | </code> | ||