⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setup.sh

📁 很少见的linux下的红外口的工具
💻 SH
📖 第 1 页 / 共 2 页
字号:
#! /bin/shLIRC_VERSION="0.6.6"############################################################################### Default ValuesCOM1_PORT=0x3f8COM2_PORT=0x2f8COM3_PORT=0x3e8COM4_PORT=0x2e8COM1_IRQ=4COM2_IRQ=3COM3_IRQ=4COM4_IRQ=3LPT1_PORT=0x378LPT2_PORT=0x278LPT3_PORT=0x3bcLPT1_IRQ=7LPT2_IRQ=5LPT3_IRQ=noneLIRC_DRIVER="serial"LIRC_MAJOR=61SELECTED_DRIVER=""DRIVER_PARAMETER="com1"SOFT_CARRIER="on"TRANSMITTER="off"TIMER=65536X11_WINDOWS="on"DEBUG="off"NO_DAEMONIZE="off"NO_LONG_CODES="off"USE_SYSLOG="off"############################################################################### VariablesBACKTITLE="LIRC $LIRC_VERSION Configuration"TEMP=".setup.tmp"CONFIG=".setup.config"START="configure.sh"CONFIGURE=noMAIN_MENU_TEXT="Welcome to the LIRC Configuration Menu. Here you"MAIN_MENU_TEXT="$MAIN_MENU_TEXT can configure the driver and some compile-time"MAIN_MENU_TEXT="$MAIN_MENU_TEXT settings for LIRC applications."CONFIG_DRIVER_TEXT="Please select a driver, that supports your hardware."CONFIG_SOFTWARE_TEXT="Here you can change some compile-time settings for LIRC applications"SET_PORT_TEXT="Either choose a predefined I/O base address/IRQ combination, or enter costum values"SET_PORT_TEXT="$SET_PORT_TEXT Hint: use <Space> to choose and <Enter> to proceed"SET_TTY_TEXT="Choose the tty where your hardware is available."GET_PORT_TEXT="Enter the I/O base address followed with a space and the IRQ (none for no IRQ)"############################################################################### FunctionsGetSelectedDriver ()    {    COM1="off"; COM2="off"; COM3="off"; COM4="off"    LPT1="off"; LPT2="off"; LPT3="off"; USER="off"    IRTTY="none"    if   test "$DRIVER_PARAMETER" = "com1"; then COM1="on"; LIRC_PORT=$COM1_PORT; LIRC_IRQ=$COM1_IRQ    elif test "$DRIVER_PARAMETER" = "com2"; then COM2="on"; LIRC_PORT=$COM2_PORT; LIRC_IRQ=$COM2_IRQ    elif test "$DRIVER_PARAMETER" = "com3"; then COM3="on"; LIRC_PORT=$COM3_PORT; LIRC_IRQ=$COM3_IRQ    elif test "$DRIVER_PARAMETER" = "com4"; then COM4="on"; LIRC_PORT=$COM4_PORT; LIRC_IRQ=$COM4_IRQ    elif test "$DRIVER_PARAMETER" = "tty1"; then COM1="on"; IRTTY="/dev/ttyS0"; LIRC_PORT="none"; LIRC_IRQ="none"    elif test "$DRIVER_PARAMETER" = "tty2"; then COM2="on"; IRTTY="/dev/ttyS1"; LIRC_PORT="none"; LIRC_IRQ="none"    elif test "$DRIVER_PARAMETER" = "tty3"; then COM3="on"; IRTTY="/dev/ttyS2"; LIRC_PORT="none"; LIRC_IRQ="none"    elif test "$DRIVER_PARAMETER" = "tty4"; then COM4="on"; IRTTY="/dev/ttyS3"; LIRC_PORT="none"; LIRC_IRQ="none"    elif test "$DRIVER_PARAMETER" = "lpt1"; then LPT1="on"; LIRC_PORT=$LPT1_PORT; LIRC_IRQ=$LPT1_IRQ    elif test "$DRIVER_PARAMETER" = "lpt2"; then LPT2="on"; LIRC_PORT=$LPT2_PORT; LIRC_IRQ=$LPT2_IRQ    elif test "$DRIVER_PARAMETER" = "lpt3"; then LPT3="on"; LIRC_PORT=$LPT3_PORT; LIRC_IRQ=$LPT3_IRQ    elif test "$DRIVER_PARAMETER" = "none"; then LIRC_PORT="none"; LIRC_IRQ="none"    elif test "$DRIVER_PARAMETER" = "user"; then USER="on"    fi    SELECTED_DRIVER="driver:$LIRC_DRIVER"    if test "$LIRC_PORT" != "none"; then SELECTED_DRIVER="$SELECTED_DRIVER io:$LIRC_PORT"; fi    if test "$LIRC_IRQ"  != "none"; then SELECTED_DRIVER="$SELECTED_DRIVER irq:$LIRC_IRQ"; fi    if test "$IRTTY" != "none"; then SELECTED_DRIVER="$SELECTED_DRIVER tty:$IRTTY"; fi    }GetPortAndIrq ()    {    dialog --clear --backtitle "$BACKTITLE" \           --title "Enter I/O base address and IRQ" \           --inputbox "$GET_PORT_TEXT" 9 74 "$LIRC_PORT $LIRC_IRQ" \           2> $TEMP    if test "$?" = "0"; then        {	set `cat $TEMP`        LIRC_PORT=$1        LIRC_IRQ=$2        }    else 	return 1;    fi    }SetPortAndIrq ()    {    if test "$LIRC_DRIVER" = "serial" -o \	    "$LIRC_DRIVER" = "sir" -o \	    "$LIRC_DRIVER" = "tekram" -o \	    "$LIRC_DRIVER" = "act200l" -o \	    "$LIRC_DRIVER" = "packard_bell" -o \	    "$LIRC_DRIVER" = "animax" -o \	    "$LIRC_DRIVER" = "irdeo" -o \	    "$LIRC_DRIVER" = "irdeo_remote"; then        {        dialog --clear --backtitle "$BACKTITLE" \               --title "Specify I/O base address and IRQ of your hardware" \               --radiolist "$SET_PORT_TEXT" 14 74 5 \                 1 "COM1 ($COM1_PORT, $COM1_IRQ)" $COM1 \                 2 "COM2 ($COM2_PORT, $COM2_IRQ)" $COM2 \                 3 "COM3 ($COM3_PORT, $COM3_IRQ)" $COM3 \                 4 "COM4 ($COM4_PORT, $COM4_IRQ)" $COM4 \                 9 "Other (custom values)" $USER \               2> $TEMP        if test "$?" = "0"; then            {	    set `cat $TEMP`            if   test "$1" = "1"; then DRIVER_PARAMETER="com1"            elif test "$1" = "2"; then DRIVER_PARAMETER="com2"            elif test "$1" = "3"; then DRIVER_PARAMETER="com3"            elif test "$1" = "4"; then DRIVER_PARAMETER="com4"            elif test "$1" = "9"; then DRIVER_PARAMETER="user"; GetPortAndIrq            fi            GetSelectedDriver            }	else	    return 1;        fi        }    elif test "$LIRC_DRIVER" = "parallel"; then        {        dialog --clear --backtitle "$BACKTITLE" \               --title "Specify I/O base address and IRQ of your hardware" \               --radiolist "$SET_PORT_TEXT" 13 74 4 \                 1 "LPT1 ($LPT1_PORT, $LPT1_IRQ)" $LPT1 \                 2 "LPT2 ($LPT2_PORT, $LPT2_IRQ)" $LPT2 \                 3 "LPT3 ($LPT3_PORT, $LPT3_IRQ)" $LPT3 \                 9 "Other (custom values)" $USER \                 2> $TEMP        if test "$?" = "0"; then            {	    set `cat $TEMP`            if   test "$1" = "1"; then DRIVER_PARAMETER="lpt1"            elif test "$1" = "2"; then DRIVER_PARAMETER="lpt2"            elif test "$1" = "3"; then DRIVER_PARAMETER="lpt3"            elif test "$1" = "9"; then DRIVER_PARAMETER="user"; GetPortAndIrq            fi            GetSelectedDriver            }	else	    return 1;        fi        }    elif test "$LIRC_DRIVER" = "remotemaster" -o "$LIRC_DRIVER" = "irman" -o \	"$LIRC_DRIVER" = "logitech" -o "$LIRC_DRIVER" = "pctv" -o \	"$LIRC_DRIVER" = "creative" -o "$LIRC_DRIVER" = "slinke" -o \        "$LIRC_DRIVER" = "silitek" -o "$LIRC_DRIVER" = "realmagic"; then	{        dialog --clear --backtitle "$BACKTITLE" \               --title "Select tty to use" \               --radiolist "$SET_TTY_TEXT" 13 74 6 \                 1 "COM1 (/dev/ttyS0)" $COM1 \                 2 "COM2 (/dev/ttyS1)" $COM2 \                 3 "COM3 (/dev/ttyS2)" $COM3 \                 4 "COM4 (/dev/ttyS3)" $COM4 \               2> $TEMP	}        if test "$?" = "0"; then            {	    set `cat $TEMP`            if   test "$1" = "1"; then DRIVER_PARAMETER="tty1"            elif test "$1" = "2"; then DRIVER_PARAMETER="tty2"            elif test "$1" = "3"; then DRIVER_PARAMETER="tty3"            elif test "$1" = "4"; then DRIVER_PARAMETER="tty4"            fi            GetSelectedDriver            }	else	    return 1;        fi    fi    return 0;    }DriverOptions ()    {    if   test "$LIRC_DRIVER" = "serial"; then        {        dialog --clear --backtitle "$BACKTITLE" \               --title "Driver specific Options" \               --checklist "" 10 74 2 \                 1 "With transmitter diode" $TRANSMITTER \                 2 "Software generated carrier" $SOFT_CARRIER \               2> $TEMP        if test "$?" = "0"; then            {	    set -- `cat $TEMP`            SOFT_CARRIER="off"	    TRANSMITTER="off"            for ITEM in $@; do                {                if   test $ITEM = "\"1\""; then TRANSMITTER="on";                elif test $ITEM = "\"2\""; then SOFT_CARRIER="on";                fi                }            done#	    if test "$TRANSMITTER" = "off"; then SOFT_CARRIER="off"; fi            }	else	    return 1;        fi        }    elif test "$LIRC_DRIVER" = "parallel"; then        {        dialog --clear --backtitle "$BACKTITLE" \               --title "Driver specific Options" \               --inputbox "Timer value for parallel port driver" 9 74 "$TIMER" \               2> $TEMP        if test "$?" = "0"; then            {	    set `cat $TEMP`            TIMER=$1            }	else	    return 1;        fi        }    fi    return 0;    }ConfigDriver ()    {    dialog --clear --backtitle "$BACKTITLE" \           --title "Select your driver" \           --menu "$CONFIG_DRIVER_TEXT" 16 74 9 \             1 "Home-brew (16x50 UART compatible serial port)" \             2 "Home-brew (parallel port)" \	     3 "Home-brew (soundcard input, EXPERIMENTAL)" \	     4 "Other serial port devices" \	     5 "TV card" \	     6 "IrDA hardware" \	     7 "PDAs" \	     8 "Network (UDP)" \	     9 "None (network connections only)" 2> $TEMP    if test "$?" = "0"; then        {	set `cat $TEMP`        if   test "$1" = "1"; then LIRC_DRIVER=serial;   DRIVER_PARAMETER=com1;        elif test "$1" = "2"; then LIRC_DRIVER=parallel; DRIVER_PARAMETER=lpt1;        elif test "$1" = "3"; then LIRC_DRIVER=dsp;      DRIVER_PARAMETER=none;        elif test "$1" = "4"; then	    # "Other serial port devices"	    dialog --clear --backtitle "$BACKTITLE" \                --title "Select your driver" \		--menu "$CONFIG_DRIVER_TEXT" 19 74 12 \			1 "Anir Multimedia Magic" \			2 "CARACA" \			3 "Creative Infra Receiver" \			4 "IRdeo" \			5 "IRdeo Remote" \			6 "Irman / UIR" \			7 "Logitech/AST" \			8 "Miro PCTV receiver" \			9 "Packard Bell receiver" \			0 "Pinnacle Systems PCTV (pro) receiver" \			a "PixelView RemoteMaster RC2000/RC3000" \			b "REALmagic (bundled with Hollywood Plus DVD card)" \			c "Slink-e (receive only)" \                        d "Silitek SM-1000" \			e "Tekram Irmate 210 (16x50 UART compatible serial port)" 2> $TEMP;	    if test "$?" = "0"; then		{		set `cat $TEMP`		if   test "$1" = "1"; then LIRC_DRIVER=animax;       DRIVER_PARAMETER=com1;		elif test "$1" = "2"; then LIRC_DRIVER=caraca;       DRIVER_PARAMETER=tty1;		elif test "$1" = "3"; then LIRC_DRIVER=creative;     DRIVER_PARAMETER=tty1;		elif test "$1" = "4"; then LIRC_DRIVER=irdeo;        DRIVER_PARAMETER=com1;		elif test "$1" = "5"; then LIRC_DRIVER=irdeo_remote; DRIVER_PARAMETER=com1;		elif test "$1" = "6"; then LIRC_DRIVER=irman;        DRIVER_PARAMETER=tty1;		elif test "$1" = "7"; then LIRC_DRIVER=logitech;     DRIVER_PARAMETER=tty1;		elif test "$1" = "8"; then LIRC_DRIVER=pctv;         DRIVER_PARAMETER=tty1;		elif test "$1" = "9"; then LIRC_DRIVER=packard_bell; DRIVER_PARAMETER=com1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -