Ai
3 Star 1 Fork 1

Gitee 极速下载/linuxconsole

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/flosse/linuxconsole
克隆/下载
ident 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/awk -f
BEGIN {
FS = "\"";
kernel = "";
name = "";
serial = "";
vendor = "";
product = "";
seckernel = "";
secname = "";
secserial = "";
secvendor = "";
secproduct = "";
}
/KERNEL==/ {
kernel = $2;
}
/KERNELS==/ {
seckernel = $2;
}
/ATTRS{name}/ {
secname = $2;
}
/ATTRS{serial}/ {
secserial = $2;
}
/ATTRS{idVendor}/ {
secvendor = $2;
}
/ATTRS{idProduct}/ {
secproduct = $2;
}
/$^/ {
# New section, check the values remembered from the previous
# If the section defined a name, and we don't have one, and the
# section described an input device, store the name and serial
if (match(seckernel, "input") != 0 && secname != "" && name == "") {
name = secname;
serial = secserial;
}
# If the section defined a vendor (for USB devices), and we don't
# have one, store the vendor and product
if (secvendor != "" && vendor == "") {
vendor = secvendor;
product = secproduct;
}
# Clear all section values before processing next section
seckernel = "";
secname = "";
secserial = "";
secvendor = "";
secproduct = "";
}
END {
print "DEVICE=\"" kernel "\"";
print "NAME=\"" name "\"";
print "SERIAL=\"" serial "\"";
print "VENDOR=\"" vendor "\"";
print "PRODUCT=\"" product "\"";
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors/linuxconsole.git
git@gitee.com:mirrors/linuxconsole.git
mirrors
linuxconsole
linuxconsole
master

搜索帮助