#!/bin/bash

获取鼠标外设的idVendor和idProduct

查找鼠标设备的路径

mouse_path=$(grep -E 'Name.*Mouse' /proc/bus/input/devices | grep -oE 'event[0-9]+')

获取idVendor和idProduct

idVendor=$(udevadm info --query=all --name=/dev/input/$mouse_path | grep -oE 'ID_VENDOR_ID=[0-9a-fA-F]{4}' | cut -d'=' -f2) idProduct=$(udevadm info --query=all --name=/dev/input/$mouse_path | grep -oE 'ID_MODEL_ID=[0-9a-fA-F]{4}' | cut -d'=' -f2)

echo "鼠标外设的idVendor为:$idVendor" echo "鼠标外设的idProduct为:$idProduct"

shell写个脚本获取linux服务器鼠标外设的idVendor、idProduct

原文地址: https://www.cveoy.top/t/topic/bdxR 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录