{"id":1435,"date":"2026-04-18T20:53:03","date_gmt":"2026-04-18T12:53:03","guid":{"rendered":"https:\/\/imuslab.com\/wordpress\/?p=1435"},"modified":"2026-04-18T20:57:11","modified_gmt":"2026-04-18T12:57:11","slug":"dezkvm-%e8%a3%9d%e7%bd%ae%e9%85%8d%e7%bd%ae%e7%b5%84%e5%90%88%e5%a4%a7%e9%9b%a3%e9%a1%8c-%e5%a6%82%e4%bd%95%e5%9c%a8-linux-%e4%b8%8a%e7%9f%a5%e9%81%93%e5%93%aa%e4%ba%9b-usb-%e8%a3%9d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/imuslab.com\/wordpress\/2026\/04\/18\/dezkvm-%e8%a3%9d%e7%bd%ae%e9%85%8d%e7%bd%ae%e7%b5%84%e5%90%88%e5%a4%a7%e9%9b%a3%e9%a1%8c-%e5%a6%82%e4%bd%95%e5%9c%a8-linux-%e4%b8%8a%e7%9f%a5%e9%81%93%e5%93%aa%e4%ba%9b-usb-%e8%a3%9d%e7%bd%ae\/","title":{"rendered":"DezKVM \u88dd\u7f6e\u914d\u7f6e\u7d44\u5408\u5927\u96e3\u984c &#8211; \u5982\u4f55\u5728 Linux \u4e0a\u77e5\u9053\u54ea\u4e9b USB \u88dd\u7f6e\u662f\u4e00\u7d44\u7684\uff1f"},"content":{"rendered":"\n<p>\u6700\u8fd1\u5728\u958b\u767c\u7684 DezKVM \u6709\u4e00\u500b\u5f88\u6709\u8da3\u7684\u6a21\u7d44\u53eb KVM-port unit\uff0c\u7c21\u55ae\u4f86\u8aaa\u5c31\u662f\u4e00\u500b\u628a HDMI \u63a1\u96c6\u3001\u9375\u76e4\u6ed1\u9f20\u6a21\u64ec\uff08KVM\uff09\u3001ATX \u63a7\u5236\u8ddf USB \u5132\u5b58\u88dd\u7f6e\u5207\u63db\u5668\u96c6\u6210\u4e00\u984c\u7684\u6a21\u7d44\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"583\" src=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-1024x583.png\" alt=\"\" class=\"wp-image-1436\" srcset=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-1024x583.png 1024w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-300x171.png 300w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-768x437.png 768w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-1200x683.png 1200w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247.png 1297w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"955\" height=\"594\" src=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-1.png\" alt=\"\" class=\"wp-image-1437\" srcset=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-1.png 955w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-1-300x187.png 300w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-1-768x478.png 768w\" sizes=\"auto, (max-width: 955px) 100vw, 955px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"851\" height=\"589\" src=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-2.png\" alt=\"\" class=\"wp-image-1438\" srcset=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-2.png 851w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-2-300x208.png 300w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-2-768x532.png 768w\" sizes=\"auto, (max-width: 851px) 100vw, 851px\" \/><\/figure>\n\n\n\n<p>\u9019\u6771\u897f\u4e0a\u9762\u6709\u5169\u9846 Serial Chip\uff0c\u4e00\u9846\u662f CH340C \uff08USB serial driver\uff09\u8207 CH552G \uff08USB ACM driver\uff09\uff0c\u52a0\u4e0a HDMI capture card \u986f\u793a\u7684 UVC \u88dd\u7f6e\u548c USB mass storage \u7528\u7684 block device driver\uff0c\u6700\u5f8c\u7528\u4e00\u9846 USB2.0 4 \u500b downstream port \u7684 USB hub chip \u9023\u63a5\u8d77\u4f86\u3002\u6240\u4ee5\u5982\u679c\u7cfb\u7d71\u4e0a\u53ea\u63d2\u4e00\u6839\u9019\u500b Port Unit \u5012\u662f\u6c92\u751a\u9ebc\u554f\u984c\u5f88\u5bb9\u6613\u8a8d\u51fa\u4f86\uff0c\u7562\u7adf ttyUSB0 + ttyACM0 + video0\/1 + sda1 \u9019\u6a23\u5c31\u662f\u4e00\u7d44 KVM \u88dd\u7f6e\u4e86\u3002\u4f46\u662f\u5982\u679c\u4f60\u5728\u540c\u4e00\u53f0 Host \u4e0a\u9762\u63d2\u591a\u500b Port Unit \u600e\u9ebc\u8fa6\uff1f<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8a2d\u8a08\u53ef\u64f4\u5c55\u7684 KVM Port \u67b6\u69cb<\/h2>\n\n\n\n<p>\u5982\u679c\u4f60\u628a\u591a\u65bc\u4e00\u53f0\u7684 KVM port unit \u63d2\u5230\u540c\u4e00\u53f0\u96fb\u8166\u4e0a\u9762\uff0c\u4f60\u5728\u7528 lsusb -t \u67e5\u770b USB tree \u7684\u6642\u5019\u5c31\u6703\u770b\u5230\u985e\u4f3c\u9019\u6a23\u7684\u6771\u897f\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1004\" height=\"554\" src=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-6.png\" alt=\"\" class=\"wp-image-1445\" srcset=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-6.png 1004w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-6-300x166.png 300w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-6-768x424.png 768w\" sizes=\"auto, (max-width: 1004px) 100vw, 1004px\" \/><\/figure>\n\n\n\n<p>\uff08Port 5 \u8ddf Port 6 \u5404\u81ea\u662f\u4e00\u53f0 KVM Port unit\uff09<\/p>\n\n\n\n<p>\u9019\u6a23\u5c31\u5f88\u9ebb\u7169\u4e86\uff0c\u7562\u7adf\u4f60\u5206\u4e0d\u51fa\u4f86\u5230\u5e95\u63d2\u5728 Port 6 \u4e0b\u7684 CDC_ACM driver \u5230\u5e95 expose \u51fa\u4f86\u54ea\u500b device \uff0c\u53ef\u4ee5\u662f \/dev\/ttyACM0 \u4e5f\u53ef\u4ee5\u662f \/dev\/ttyACM1\uff0c\u90a3\u5982\u679c\u540c\u4e00\u53f0 host \u4e0a\u9762\u4e5f\u6709\u5176\u4ed6 ttyACM \u88dd\u7f6e\uff08\u4f8b\u5982\u4e00\u4e9b\u53ef\u7de8\u7a0b\u7684\u9375\u76e4\uff09\uff0c\u90a3\u600e\u9ebc\u8fa6\uff1f<\/p>\n\n\n\n<p>\u6240\u4ee5\u70ba\u4e86\u89e3\u6c7a\u9019\u500b\u554f\u984c\uff0c\u6211\u628a\u9019\u500b\u786c\u9ad4\u5206\u8fa8\u7684\u529f\u80fd\u505a\u5728\u5169\u500b\u90e8\u5206\uff0c\u4e00\u662f CH552G \u4e0a\u7684 firmware\uff0c\u53e6\u4e00\u90e8\u5206\u662f\u505a\u5728 DezKVM \u88e1\u9762\u7684\u6383\u63cf\u908f\u8f2f\u3002\u6211\u9019\u88e1\u5148\u505a CH552G \u7684 firmawre \u8b1b\u8d77\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Firmware \u7279\u5fb5\u8207 UUID<\/h2>\n\n\n\n<p>\u7531\u65bc USB KVM port unit \u4e0a\u9762\u57fa\u4e4e\u6c92\u6709\u53ef\u4ee5\u8b93\u6211\u505a\u8fa8\u8a8d\u7684\u65b9\u6cd5\uff08\u56e0\u70ba\u6bcf\u9846 KVM port unit \u7684 IC \u90fd\u4e00\u6a23\u7684\uff09\uff0c\u6240\u4ee5\u552f\u4e00\u80fd\u6bcf\u6b21\u7368\u7279\u7684\u8a8d\u51fa\u4e00\u9846 KVM port unit \u7684\u505a\u6cd5\u5c31\u53ea\u80fd\u505a\u5728\u677f\u5b50\u4e0a\u552f\u4e00\u80fd\u7de8\u7a0b\u7684 AUX-MCU \u4e0a\uff0c\u5c31\u662f\u90a3\u9846 CH552g\u3002<\/p>\n\n\n\n<p>\u9019\u9846 CH552G \u672c\u4f86\u662f\u8a2d\u8a08\u4f86\u7d66 DezKVM \u63a7\u5236\u7cfb\u7d71\u4f86\u5c0d\u9060\u7aef\u96fb\u8166\u9032\u884c ATX power control \u7528\u7684\uff0c\u5b83\u9023\u63a5\u8457\u56db\u9846 optocoupler \u4f86\u6a21\u64ec\u7528\u5bb6\u6309\u6a5f\u7bb1\u4e0a\u9762\u7684 PWR \u8207 RESET \u6309\u9215\uff1b\u53e6\u5916\u5169\u9846 optocoupler \u662f\u53cd\u904e\u4f86\u63a5\u7dda\u7684\uff0c\u7528\u4f86\u8b80\u53d6 HDD \u8207 Power LED \u7684\u4fe1\u865f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"655\" height=\"393\" src=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-3.png\" alt=\"\" class=\"wp-image-1440\" srcset=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-3.png 655w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-3-300x180.png 300w\" sizes=\"auto, (max-width: 655px) 100vw, 655px\" \/><\/figure>\n\n\n\n<p>\u7531\u65bc\u9019\u9846 MCU \u4e5f\u662f\u8ddf DezKVM \u7cfb\u7d71\u900f\u904e Serial \u5354\u8b70\u6e9d\u901a\uff0c\u52a0\u4e0a firmware \u662f\u6211\u81ea\u5df1\u958b\u767c\u7684\uff0c\u6240\u4ee5\u5c31\u53ef\u4ee5\u9806\u4fbf\u585e\u4e00\u500b\u6307\u4ee4\u9032\u53bb\uff1a\u7576\u6536\u5230 0x75 \uff08ASCII \u7684 &#8216;u&#8217;\uff09\u6642\uff0c\u56de\u50b3\u5b83\u7684 UUID\u3002 \u5728 firmware \u88e1\u9762\u5927\u6982\u662f\u9019\u6a23\u7684\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/*\n  kvm_uuid_service.ino\n  author: tobychui\n\n  This file contains code that uniquely\n  identify a USB-KVM downstream device for\n  multi-device setups.\n\n  Command Structure\n  &lt;Length&gt; 0x62 &lt;UUID String&gt;\n*\/\n\n#define DEVICE_UUID \"11957cd5-1021-434e-975b-74a861d61b31\" \/\/UUIDv4, Change this UUID for each device\n\nvoid print_device_uuid() {\n  USBSerial_write(0x25); \/\/Length byte\n  USBSerial_write(0x62); \/\/Command identifier\n  USBSerial_print(DEVICE_UUID); \/\/UUID string\n}<\/code><\/pre>\n\n\n\n<p>\u53e6\u5916\u6211\u9019\u908a\u70ba\u4e86\u76f8\u5bb9\u4e0d\u540c\u985e\u578b\u7684\u6307\u4ee4\uff0c\u4f7f\u7528\u4e86 Bluetooth \u5354\u8b70\u76f8\u540c\u7684 LTV \u6307\u4ee4\u67b6\u69cb\u3002Device ID \u662f\u7279\u5225\u4f7f\u7528 &#8217;11&#8217; \u958b\u982d\u7684\uff0c\u610f\u601d\u662f Device category = 1, device type = 1\uff0c\u9019\u500b\u4e4b\u5f8c\u6709\u9700\u8981\u64f4\u5c55\u5176\u4ed6\u6a21\u7d44\u7684\u6642\u5019\u6703\u5f88\u597d\u7528\u3002\u53e6\u5916\u984c\u5916\u8a71\uff0c\u4e0d\u5f97\u4e0d\u8aaa Bluetooth \u7684 LTV \u6307\u4ee4\u65b9\u5f0f\u771f\u7684\u662f\u70ba\u7701\u96fb\u8207\u4f4e\u8655\u7406\u80fd\u529b\u7684\u88dd\u7f6e\u800c\u8a2d\u8a08\u7684\uff0c\u6574\u500b\u6307\u4ee4\u53ea\u8981 sequential read \u4e00\u6b21\u5c31\u53ef\u4ee5\u76f4\u63a5\u52d5\u4f5c\u4e86\uff0c\u4e0d\u9700\u8981\u50cf Json \u6216\u662f xml \u9019\u6a23\u505a parsing \u6d6a\u8cbb 8051 MCU \u4e0a\u7684 cpu cycles\u3002<\/p>\n\n\n\n<p>\u5c31\u662f\u9019\u6a23\uff0c\u53ea\u8981 host software \u60f3\u8981\u77e5\u9053\u9019\u9846 MCU \u7684 UUID \u7684\u6642\u5019\uff0c\u53ea\u8981\u5f80 serial \u88e1\u9762\u50b3\u500b &#8216;u&#8217; \u5b83\u5c31\u6703\u56de\u50b3\u6574\u4e32 UUID \u4e86\u3002 <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Host Software \u628a KVM port unit \u6293\u51fa\u4f86\u7684\u65b9\u6cd5<\/h2>\n\n\n\n<p>\u5c31\u5982\u4e0a\u9762\u6240\u8aaa\u7684\uff0c\u56e0\u70ba\u6bcf\u500b port unit \u7684 IC \u7279\u5fb5\u90fd\u4e00\u6a23\uff0c\u5f88\u96e3\u8fa8\u8a8d\u54ea\u4e00\u7fa4 device \u662f\u4e00\u500b port unit\u3002\u52a0\u5165\u4e86 firmware UUID \u4e4b\u5f8c\u4e5f\u662f\u53ea\u80fd\u77e5\u9053\u54ea\u9846MCU \u662f\u54ea\u4e00\u9846\uff0c\u5176\u4ed6\u4f8b\u5982 HDMI \u63a1\u96c6\u5361\u4e4b\u985e\u7684\u9084\u662f\u4e0d\u77e5\u9053\u4e0d\u662f\u55ce\uff1f<\/p>\n\n\n\n<p>\u9019\u500b\u6642\u5019\u6211\u5011\u5c31\u662f\u8981\u53bb\u7ffb \/dev \u8cc7\u6599\u593e\u4e86\u3002Linux \u7684\u597d\u8655\u5c31\u662f\u751a\u9ebc\u90fd\u662f\u6a94\u6848\uff0c\u58de\u8655\u5c31\u662f\u770b\u4e0a\u53bb\u50cf kernel \u5728\u6bcf\u6b21\u6709\u786c\u9ad4\u6216\u8edf\u9ad4\u8b8a\u66f4\u7684\u6642\u5019\u5c31\u5728\u4e0d\u77e5\u9053\u54ea\u88e1\u4e82\u62c9\u5c4e\u3002\u4ee5 serial device \u70ba\u4f8b\uff0c\u7576\u7cfb\u7d71\u63a5\u4e0a\u4e26\u8f09\u5165\u4e00\u500b serial device \u4e4b\u5f8c\uff0c\u5c31\u6703\u5728 \/dev\/serial\/ \u4e0b\u5efa\u7acb\u4e00\u500b\u300c\u6a94\u6848\u300d\u4e26\u6307\u5411\u8a72\u88dd\u7f6e\u7684\u8def\u5f91\uff08\u800c\u4e14\u9084\u8981\u662f\u76f8\u5c0d\u8def\u5f91\uff0c\u984d\u3002\u3002\u3002\uff09<\/p>\n\n\n\n<p>\u4ee5\u6211\u9019\u53f0\u63d2\u4e86\u5169\u500b KVM port unit + OLED HMI \uff08\u4e5f\u662f\u4f7f\u7528 ch552g \u9a45\u52d5\uff09\u7684\u70ba\u4f8b\uff0c\u76f4\u63a5 ls \u7684\u8a71\u6703\u770b\u5230\u9019\u5806\u8cc7\u8a0a\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ls -l \/dev\/serial\/by-path\ntotal 0\nlrwxrwxrwx 1 root root 13 Apr 18 17:45 pci-0000:00:14.0-usb-0:2:1.0 -&gt; ..\/..\/ttyACM1\nlrwxrwxrwx 1 root root 13 Apr 18 19:56 pci-0000:00:14.0-usb-0:5.1:1.0 -&gt; ..\/..\/ttyACM0\nlrwxrwxrwx 1 root root 13 Apr 18 19:56 pci-0000:00:14.0-usb-0:5.3:1.0-port0 -&gt; ..\/..\/ttyUSB0\nlrwxrwxrwx 1 root root 13 Apr 18 19:56 pci-0000:00:14.0-usb-0:6.1:1.0 -&gt; ..\/..\/ttyACM2\nlrwxrwxrwx 1 root root 13 Apr 18 19:56 pci-0000:00:14.0-usb-0:6.3:1.0-port0 -&gt; ..\/..\/ttyUSB1\n<\/code><\/pre>\n\n\n\n<p>\u9019\u6a23\u5c31\u5f88\u80fd\u5920\u770b\u51fa\u4f86\u9019\u7fa4 USB port \u662f\u7531\u751a\u9ebc\u65b9\u5f0f\u5f04\u51fa\u4f86\u7684\u4e86\u3002\u61c9\u8a72\u662f pcie \u901a\u9053\u4e0a\u63d2\u4e86\u5f35 PCIE \u8f49 USB port \u7684\u5361\uff08\u61c9\u8a72\u662f\u76f4\u63a5\u710a\u5728\u4e3b\u677f\u4e0a\u7684\uff09\uff0c\u7136\u5f8c\u8f49\u63db\u51fa\u4f86\u7684 USB \u7aef\u53e3\u53c8\u63a5\u4e86\u4e00\u5806 serial devices\u3002\u5f9e 0:2 \u7684\u90e8\u5206\u53ef\u4ee5\u770b\u5230\uff0c port 2 \u4e0b\u9762\u6709\u4e00\u9846 ttyACM1\uff0c\u9019\u500b\u61c9\u8a72\u5c31\u662f\u6211\u7684 OLED HMI \u4e86\u3002\u53e6\u5916\u5169\u7d44 0:5 \u8ddf 0:6 \u90fd\u662f\u6709\u5169\u500b tty \u88dd\u7f6e\u7684\uff0c\u800c\u4e14\u56e0\u70ba\u4ed6\u5011\u5728\u540c\u4e00\u500b root hub + 1 \u5c64 node \u4e0a\uff0c\u6240\u4ee5\u4ed6\u5011\u662f\u540c\u4e00\u7d44\u7684\u3002<\/p>\n\n\n\n<p>\u63db\u53e5\u8a71\u8aaa\uff0c\u5f9e\u9019\u5806\u795e\u5947\u7684\u6578\u5b57\uff0c\u56e0\u70ba usb- \u5f8c\u9762\u7684 0:5 \u8ddf 0:6 \u662f\u4e00\u6a23\u7684\uff0c\u6211\u5c31\u53ef\u4ee5\u5f97\u77e5ttyACM0 \u8207 ttyUSB0 \u662f\u540c\u4e00\u500b KVM port unit\uff0c\u7136\u5f8c ttyACM2 \u8207 ttyUSB1 \u53c8\u662f\u540c\u4e00\u7d44 KVM port unit\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u63db\u4e00\u500b\u5bb9\u6613 parse \u7684\u65b9\u6cd5\u4f86\u6293\u597d\u4e0d<\/h3>\n\n\n\n<p>\u9664\u4e86\u76f4\u63a5 ls \u4e4b\u5916\uff0c\u4e5f\u53ef\u4ee5\u7528\u4e00\u500b Linux tool \u5225 udevadm \u4f86\u53d6\u5f97\u9019\u500b device \u7684\u5b8c\u6574\u8def\u5f91\u3002\u5b83\u7684\u8f38\u51fa\u5927\u6982\u662f\u9019\u6a23<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/devices\/pci0000:00\/0000:00:14.0\/usb1\/1-2\/1-2:1.0\/tty\/ttyACM0\n<\/code><\/pre>\n\n\n\n<p>\u9019\u6a23\u5728 code \u88e1\u9762\u8981 parse \u5c31\u7c21\u55ae\u591a\u4e86\uff0c\u76f4\u63a5 split &#8220;\/&#8221; \u5c31\u597d\uff08<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>func getDeviceFullPath(devicePath string) (string, error) {\n\tresolvedPath, err := resolveSymlink(devicePath)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t\/\/ Use udevadm to get the device chain\n\tout, err := exec.Command(\"udevadm\", \"info\", \"-q\", \"path\", \"-n\", resolvedPath).Output()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tsysPath := strings.TrimSpace(string(out))\n\tif sysPath == \"\" {\n\t\treturn \"\", errors.New(\"could not resolve sysfs path\")\n\t}\n\n\tfullPath := \"\/sys\" + sysPath\n\treturn fullPath, nil\n}\n<\/code><\/pre>\n\n\n\n<p>\u6ce8\u610f\u5230\u90a3\u500b \/sys \u7684\u90e8\u5206\uff1f\u56e0\u70ba udevadm \u662f\u6703\u56de\u50b3\u5f9e \/sys \u7684\u76f8\u5c0d\u8def\u5f91\uff08\u9084\u771f\u7684\u4e00\u9ede consistency \u90fd\u6c92\u6709\uff0c\u8d85\u8b9a\uff01\uff09\uff0c\u6240\u4ee5\u9019\u88e1\u8981\u52a0\u500b \/sys \u4f86\u53d6\u5f97\u5b8c\u6574\u7684 device path\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u6293\u51fa common hub pattern<\/h3>\n\n\n\n<p>\u6709\u4e86\u5b8c\u6574 device path \u4e4b\u5f8c\uff0c\u5269\u4e0b\u7684\u5927\u6982\u5c31\u662f\u8ddf\u300c\u5728\u4e00\u5806\u6587\u4ef6\u6e05\u55ae\u88e1\u9762\u6293\u51fa\u54ea\u4e9b\u6587\u4ef6\u662f\u540c\u4e00\u500b\u8cc7\u6599\u593e\u300d\u4e00\u6a23\u7c21\u55ae\u3002\u552f\u4e00\u8981\u505a\u7684\u5c31\u662f\u628a x-x \u9019\u500b pattern \u5168\u90e8\u6293\u51fa\u4f86\uff0c\u4e26\u628a\u5b83\u7576\u6210\u4e00\u500b map \uff08JavaScript \u7684 Object \u6216\u662f Python \u7684 dict\uff0c\u5982\u679c\u4f60 data structure \u6c92\u4fee\u904e\uff09 \u7684 key \u7136\u5f8c\u628a\u5176\u9918\u7684 USB devices \u6293\u51fa\u4f86\uff1a <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Find common USB root hub prefix\nhubPattern := regexp.MustCompile(`^\\d+-\\d+(\\.\\d+)*$`)\ngetHub := func(sys string) string {\n\tparts := strings.Split(sys, \"\/\")\n\tfor i := range parts {\n\t\t\/\/ Look for USB hub pattern (e.g. 1-2, 2-1, etc.)\n\t\tif hubPattern.MatchString(parts&#91;i]) {\n\t\t\treturn strings.Join(parts&#91;:i+1], \"\/\")\n\t\t}\n\t}\n\treturn \"\"\n}<\/code><\/pre>\n\n\n\n<p>\u4f8b\u5982 video device path \u7684 mapper \u5982\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for _, v := range videos {\n\thub := getHub(v.sysPath)\n\tif hub != \"\" {\n\t\tif hubs&#91;hub] == nil {\n\t\t\thubs&#91;hub] = &amp;hubGroup{}\n\t\t}\n\t\thubs&#91;hub].videos = append(hubs&#91;hub].videos, v.path)\n\t}\n}<\/code><\/pre>\n\n\n\n<p>\u9019\u6a23\u4f60\u5c31\u6210\u529f\u5206\u985e\u597d\u540c\u4e00\u500b KVM port unit \u88e1\u9762\u7684\u6240\u6709 devices \u4e86\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Filter \u975e KVM Port unit \u7684\u88dd\u7f6e<\/h2>\n\n\n\n<p>\u9084\u8a18\u5f97\u4e0a\u9762\u6709\u8b1b\u5230 device ID \u4e00\u5b9a\u8981 11 \u958b\u982d\u55ce\uff1f\u90a3\u662f\u56e0\u70ba\u6211\u501f\u7528\u4e86 UUID \u524d1 \u500b byte \u4f5c\u70ba\u88dd\u7f6e\u985e\u578b\u7684\u5206\u985e\u3002\u96d6\u7136\u96a8\u6a5f\u91cd\u8986\u7684\u6a5f\u7387\u6709\u7a0d\u70ba\u4e0a\u5347\uff0c\u4f46\u662f\u5982\u679c\u5e02\u9762\u4e0a\u771f\u7684\u9019\u9ebc\u591a\u53f0\u7684\u8a71\u5230\u6642\u5019\u6211\u8981\u7169\u60f1\u7684\u554f\u984c\u61c9\u8a72\u4e0d\u662f\u9019\u500b\uff08<\/p>\n\n\n\n<p>\u6240\u4ee5\u53ea\u6703\u6709\u4ee5\u4e0b\u5169\u500b case<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u8a72 Serial device \u662f\u76f8\u5bb9\u88dd\u7f6e\uff0c\u4f46\u662f UUID \u975e 1 \u958b\u982d\u6240\u4ee5\u76f4\u63a5\u4e0d\u7406\u6703\u597d\u4e86\u3002<\/li>\n\n\n\n<li>\u8a72 Serial device \u662f\u975e\u76f8\u5bb9\u88dd\u7f6e\uff0c\u50b3 u \u9032\u53bb\u4e0d\u6703\u6709\u53cd\u61c9\u6216\u662f\u6703\u56de\u8986\u5176\u4ed6\u975e LTV structure \u7684 byte stream\uff0c\u9019\u6a23 DezKVM software \u76f4\u63a5 close serial port \u5c31\u597d\u4e86<\/li>\n<\/ol>\n\n\n\n<p>\u9019\u6a23\u5c31\u80fd\u5b8c\u7f8e\u628a KVM Port Unit \u88dd\u7f6e\u6293\u51fa\u4f86\u4e86\uff01<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"642\" src=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-4-1024x642.png\" alt=\"\" class=\"wp-image-1442\" srcset=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-4-1024x642.png 1024w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-4-300x188.png 300w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-4-768x482.png 768w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-4-1200x752.png 1200w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-4.png 1515w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"639\" src=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-5-1024x639.png\" alt=\"\" class=\"wp-image-1443\" srcset=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-5-1024x639.png 1024w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-5-300x187.png 300w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-5-768x479.png 768w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-5-1200x749.png 1200w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2026\/04\/\u5716\u7247-5.png 1476w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u5728\u958b\u767c\u7684 DezKVM \u6709\u4e00\u500b\u5f88\u6709\u8da3\u7684\u6a21\u7d44\u53eb KVM-port unit\uff0c\u7c21\u55ae\u4f86\u8aaa\u5c31\u662f\u4e00\u500b\u628a HDMI \u63a1\u96c6\u3001\u9375\u76e4\u6ed1\u9f20\u6a21\u64ec\uff08KVM\uff09\u3001ATX \u63a7\u5236\u8ddf USB \u5132\u5b58\u88dd\u7f6e\u5207\u63db\u5668\u96c6\u6210\u4e00\u984c\u7684\u6a21\u7d44\u3002 \u9019\u6771\u897f\u4e0a\u9762\u6709\u5169\u9846 Serial Chip\uff0c\u4e00\u9846\u662f CH340C \uff08USB serial driver\uff09\u8207 CH552G \uff08USB ACM driver\uff09\uff0c\u52a0\u4e0a HDMI capture card \u986f\u793a\u7684 UVC \u88dd\u7f6e\u548c USB mass storage \u7528\u7684 block device driver\uff0c\u6700\u5f8c\u7528\u4e00\u9846 USB2.0 4 \u500b downstream port \u7684 USB hub chip \u9023\u63a5\u8d77\u4f86\u3002\u6240\u4ee5\u5982\u679c\u7cfb\u7d71\u4e0a\u53ea\u63d2\u4e00\u6839\u9019\u500b Port Unit \u5012\u662f\u6c92\u751a\u9ebc\u554f\u984c\u5f88\u5bb9\u6613\u8a8d\u51fa\u4f86\uff0c\u7562\u7adf ttyUSB0 + ttyACM0 + video0\/1 + sda1 \u9019\u6a23\u5c31\u662f\u4e00\u7d44 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[111],"tags":[],"class_list":["post-1435","post","type-post","status-publish","format-standard","hentry","category-remdeskvm"],"_links":{"self":[{"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/posts\/1435","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1435"}],"version-history":[{"count":4,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/posts\/1435\/revisions"}],"predecessor-version":[{"id":1446,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/posts\/1435\/revisions\/1446"}],"wp:attachment":[{"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}