ofindhsx

来自「udev是一种工具」· 代码 · 共 47 行

TXT
47
字号
#!/bin/bash## Sample Script to find out the ttyHSO to functional matching# search_device# search for all Option USB WWAN modem and# return the full path of the base device# input parameter:#   none# return:#   in RETVAL the result#   0 on susscess#   1 on errorfunction search_device() {    local ROOT="/sys/bus/usb/devices"    local VENDOR="0af0"    RETVAL=""    for DIR in $( ls ${ROOT} ); do	if [ -L "${ROOT}/${DIR}" ]; then	    if [ -f "${ROOT}/${DIR}/idVendor" ]; then		IDVENDOR=$( cat "${ROOT}/${DIR}/idVendor" )		if [ "${IDVENDOR}" = "${VENDOR}" ]; then		    RETVAL="${RETVAL} ${ROOT}/${DIR}"		fi	    fi	fi    done    if [ -z "${RETVAL}" ]; then	return 1    fi    return 0}search_devicefor dev in  ${RETVAL}; do    cd ${dev}    DEVID=0x$( cat idProduct )    echo "Found Option Device with DeviceID = ${DEVID}"    for ttytype in $( find . -name hsotype ); do	HSOTYPE=$( cat ${ttytype} )	TTYHSO=/dev/$( echo ${ttytype} | sed -e "s/.*\/\(ttyHS[0-9]\+\)\/hsotype/\1/" )	echo "${TTYHSO} is ${HSOTYPE}"    donedone

⌨️ 快捷键说明

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