home > linux > scripts > pci-and-xinput-device-checker-scripts

PCI and xinput device checker scripts

| 14 Oct 2011

This scripts enable you to search for pci and xinput devices easily.

Script to search pci devices by name easily;

#!/bin/bash
# mike.j - 13/10/2011
# linux pci checker for dummies :P

if [ "$1" != "" ]; then
    searchTerm=$1
    shift
    if [ -z "$(lspci | nl | grep -i "$searchTerm")" ]; then
        echo "device not found..."
    else
        lspci -d $(echo $(lspci -n | nl | head -$(echo $(lspci | nl | grep -i "$searchTerm") | cut -d " " -f 1) | tail -1) | cut -d " " -f 4) -v $@
    fi
else
    echo "please specify peramiters..."
fi

Script to check xinput devices easily;

#!/bin/bash
# mike.j - 13/10/2011
# linux xinput checker for dummies :P

if [ "$1" != "" ]; then
    searchTerm=$1
    shift
    searchedDevice=$(xinput list | grep -i $searchTerm | cut -d "=" -f 2 | cut -b 1-2)
    if [ -z "$searchedDevice" ]; then
        echo "device not found..."
    else
        echo "-------- device -------- "
        xinput --list $searchedDevice
        echo "-------- device props -------- "
        xinput --list-props $searchedDevice
    fi
else
    echo "please specify peramiters..."
fi

Post a Comment