#!/bin/sh # Currently not tested: # -serial (minicom?) # -parallel port (plip's loopback adaptor?) # -keyboard (should be tested in the process) # -Irda (peer to peer irda) # -Midi playback LOG=diag.log DIALOG="dialog --clear --title" TEMP=/tmp/testscripts.tmp.$$ IP=10.1.1.100 echo DIAGNOSTIC LOG > $LOG echo >> $LOG function yesno_box { $DIALOG "$TITLE" --yesno "$MESSAGE" 13 50 RESULT=$? if [ $RESULT = 0 ]; then echo `date` $TITLE succeded >> $LOG else echo `date` $TITLE failed >> $LOG fi } function info_box { $DIALOG "$TITLE" --msgbox "$MESSAGE" 13 50 } function mouse_test { # This test is lame. There was a better one with ncurses, but it was # lost when lowram was upgraded :( TITLE="Mouse Test" MESSAGE="Move the mouse. Do you see a cursor moving around the screen?" yesno_box } function date_test { TITLE="Date Test" MESSAGE="Is this the current date: \n`date`?" yesno_box } function fan_test { TITLE="Fan Test" set_therm 100 >/dev/null 2>&1 MESSAGE="The fan speed should drop." info_box set_therm 0 >/dev/null 2>&1 MESSAGE="The fan speed should rise." info_box set_therm 50 >/dev/null 2>&1 MESSAGE="Is the fan functional?" yesno_box } function audio_in_test { ./mixer -mic=100 ./mixer -reclev=0 TITLE="Audio in test" # Line in Test MESSAGE="\ Ensure that the handset has been disconnected. Audio can be heard through \ either the built-in speaker or via the stereo line-out. Is the line-in \ functioning?" ./mixer -source=6 ./audio & yesno_box killall audio # Mic Test MESSAGE="\ Ensure that the handset has been disconnected. Audio can be heard through \ either the built-in speaker or via the stereo line-out. Is the built-in mic \ functioning?" ./mixer -source=7 ./audio & yesno_box killall audio # Handset Test MESSAGE="Ensure that a handset is connected. Is handset input working?" ./mixer -source=14 ./audio & yesno_box killall audio } function audio_out_test { TITLE="Audio out test" MESSAGE="\ Ensure that line-out and the headset are connected, and that the volume \ slider is at 1/2" info_box # Speaker Test MESSAGE="Did sound come out of the build-in speaker?" ./mixer -private=0x10 bplay stereo.wav yesno_box # Line Out test MESSAGE="Did sound come out of line out?" ./mixer -private=0x11 bplay stereo.wav yesno_box # Handset Test MESSAGE="Did sound come out of the handset?" ./mixer -private=0x51 bplay stereo.wav yesno_box } function cyber2k_test { /sbin/rmmod tv /sbin/rmmod vidcap TITLE="Graphics test" MESSAGE="\ Ensure video-in and video-out are hooked up. After the test begins, press \ enter to exit." info_box MESSAGE="Is the video chip (CyberPro 2000) working?" /sbin/insmod -f /lib/modules/misc/tv.o /sbin/insmod -f vidcap.o ./vidcap_test /sbin/rmmod tv /sbin/rmmod vidcap yesno_box } function button_test { TITLE="Button test" MESSAGE="\ After choosing OK, click the orange button. (Not twice as this will trigger \ a reboot!!)" info_box MESSAGE=`./button` yesno_box } function tulip_test { # Idea: Use a crossover cable btwn eth0 and eth1, and test ethernet # ports this way. /sbin/ifconfig eth1 $(IP) up /sbin/route add -net 10.1.0.0 netmask 255.255.0.0 eth1 # ping -f would be an interesting torture test, but it's probably not # a great idea... ping -c 1 10.1.0.0 /sbin/ifconfig eth1 down sleep 2 } function disk_burn_test { clear ./disc_burn } while true; do TITLE="Netwinder Diagnostics" $DIALOG "$TITLE" --menu "Choose a test" 18 50 10 \ "A" "PS/2 Mouse test" \ "B" "Date/Time verification" \ "C" "Fan test" \ "D" "Button test" \ "E" "Exit" \ 2> $TEMP RESULT=$? CHOICE=`cat $TEMP` rm -f $TEMP if [ $RESULT = 0 ]; then case $CHOICE in A) mouse_test ;; B) date_test ;; C) fan_test ;; D) button_test ;; E) exit 0 ;; *) exit 1 ;; esac else exit 1 fi done