{"id":3798,"date":"2023-01-07T19:46:49","date_gmt":"2023-01-07T10:46:49","guid":{"rendered":"https:\/\/matoken.org\/blog\/?p=3798"},"modified":"2023-01-07T19:47:11","modified_gmt":"2023-01-07T10:47:11","slug":"try-cyme-like-a-modern-lsusb","status":"publish","type":"post","link":"https:\/\/matoken.org\/blog\/2023\/01\/07\/try-cyme-like-a-modern-lsusb\/","title":{"rendered":"\u30e2\u30c0\u30f3\u306alsusb\u306e\u3088\u3046\u306acyme\u3092\u5c11\u3057\u8a66\u3059"},"content":{"rendered":"<div class=\"paragraph\">\n<p>rust\u88fd\u306e\u30e2\u30c0\u30f3\u306alsusb\u7684\u306acyme\u3068\u3044\u3046\u3082\u306e\u3092\u898b\u304b\u3051\u305f\u306e\u3067\u5c11\u3057\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\uff0e<br \/>\ncyme\u306flsusb\u3068\u3082\u4e92\u63db\u6027\u304c\u6709\u308a\uff0cLinux\/Windows\/macOS\u3067\u52d5\u4f5c\u3059\u308b\u3088\u3046\u3067\u3059\uff0e<\/p>\n<\/div>\n<div class=\"ulist\">\n<ul>\n<li><a href=\"https:\/\/github.com\/tuna-f1sh\/cyme\">tuna-f1sh\/cyme: List system USB buses and devices; a lib and modern lsusb that attempts to maintain compatibility with, but also add new features<\/a><\/li>\n<\/ul>\n<\/div>\n<p><!--more--><\/p>\n<div class=\"listingblock\">\n<div class=\"title\">install<\/div>\n<div class=\"content\">\n<pre>$ sudo apt install cargo libudev-dev\n$ cargo install cyme\n$ export PATH=\/home\/matoken\/.cargo\/bin:$PATH<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">help<\/div>\n<div class=\"content\">\n<pre>$ cyme -h\nList system USB buses and devices; a modern and compatible `lsusb`\n\nUsage: cyme [OPTIONS]\n\nOptions:\n  -l, --lsusb\n          Attempt to maintain compatibility with lsusb output\n  -t, --tree\n          Dump USB device hierarchy as a tree\n  -d, --vidpid &lt;VIDPID&gt;\n          Show only devices with the specified vendor and product ID numbers (in hexadecimal) in format VID:[PID]\n  -s, --show &lt;SHOW&gt;\n          Show only devices with specified device and\/or bus numbers (in decimal) in format [[bus]:][devnum]\n  -D, --device &lt;DEVICE&gt;\n          Selects which device lsusb will examine - supplied as Linux \/dev\/bus\/usb\/BBB\/DDD style path\n      --filter-name &lt;FILTER_NAME&gt;\n          Filter on string contained in name\n      --filter-serial &lt;FILTER_SERIAL&gt;\n          Filter on string contained in serial\n      --filter-class &lt;FILTER_CLASS&gt;\n          Filter on USB class code [possible values: use-interface-descriptor, audio, cdc-communications, hid, physical, image, printer, mass-storage, hub, cdc-data, smart-cart, content-security, video, personal-healthcare, audio-video, billboard, usb-type-c-bridge, i3c-device, diagnostic, wireless-controller, miscellaneous, application-specific-interface, vendor-specific-class]\n  -v, --verbose...\n          Verbosity level: 1 prints device configurations; 2 prints interfaces; 3 prints interface endpoints; 4 prints everything and all blocks\n  -b, --blocks &lt;BLOCKS&gt;\n          Specify the blocks which will be displayed for each device and in what order [possible values: bus-number, device-number, branch-position, port-path, sys-path, driver, icon, vendor-id, product-id, name, manufacturer, product-name, vendor-name, serial, speed, tree-positions, bus-power, bus-power-used, extra-current-used, bcd-device, bcd-usb, class-code, sub-class, protocol]\n      --bus-blocks &lt;BUS_BLOCKS&gt;\n          Specify the blocks which will be displayed for each bus and in what order [possible values: bus-number, icon, name, host-controller, pci-vendor, pci-device, pci-revision, port-path]\n      --config-blocks &lt;CONFIG_BLOCKS&gt;\n          Specify the blocks which will be displayed for each configuration and in what order [possible values: name, number, num-interfaces, attributes, icon-attributes, max-power]\n      --interface-blocks &lt;INTERFACE_BLOCKS&gt;\n          Specify the blocks which will be displayed for each interface and in what order [possible values: name, number, port-path, class-code, sub-class, protocol, alt-setting, driver, sys-path, num-endpoints, icon]\n      --endpoint-blocks &lt;ENDPOINT_BLOCKS&gt;\n          Specify the blocks which will be displayed for each endpoint and in what order [possible values: number, direction, transfer-type, sync-type, usage-type, max-packet-size, interval]\n  -m, --more\n          Print more blocks by default at each verbosity\n      --sort-devices &lt;SORT_DEVICES&gt;\n          Sort devices by value [possible values: branch-position, device-number, no-sort]\n      --sort-buses\n          Sort devices by bus number\n      --group-devices &lt;GROUP_DEVICES&gt;\n          Group devices by value when listing [default: no-group] [possible values: no-group, bus]\n      --hide-buses\n          Hide empty buses when printing tree; those with no devices. When listing will hide Linux root_hubs\n      --hide-hubs\n          Hide empty hubs when printing tree; those with no devices. When listing will hide hubs regardless of whether empty of not\n      --decimal\n          Show base16 values as base10 decimal instead\n      --no-padding\n          Disable padding to align blocks\n      --no-colour\n          Disable coloured output, can also use NO_COLOR environment variable\n      --ascii\n          Disables icons and utf-8 charactors\n      --headings\n          Show block headings\n      --json\n          Output as json format after sorting, filters and tree settings are applied; without -tree will be flattened dump of devices\n      --from-json &lt;FROM_JSON&gt;\n          Read from json output rather than profiling system - must use --tree json dump\n  -F, --force-libusb\n          Force libusb profiler on macOS rather than using\/combining system_profiler output\n  -c, --config &lt;CONFIG&gt;\n          Path to user config file to use for custom icons, colours and default settings\n  -z, --debug...\n          Turn debugging information on. Alternatively can use RUST_LOG env: INFO, DEBUG, TRACE\n      --mask-serials &lt;MASK_SERIALS&gt;\n          Mask serial numbers with '*' or random chars [possible values: hide, scramble, replace]\n  -h, --help\n          Print help information (use `--help` for more detail)\n  -V, --version\n          Print version information<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">\u5b9f\u884c<\/div>\n<div class=\"content\">\n<pre>$ cyme\nFailed to open Bus 002 Device 001: ID 1d6b:0003, will be unable to obtain all data: Access denied (insufficient permissions)\nFailed to open Bus 001 Device 003: ID 8087:0a2b, will be unable to obtain all data: Access denied (insufficient permissions)\nFailed to open Bus 001 Device 002: ID 5986:054c, will be unable to obtain all data: Access denied (insufficient permissions)\nFailed to open Bus 001 Device 004: ID 17ef:6047, will be unable to obtain all data: Access denied (insufficient permissions)\nFailed to open Bus 001 Device 001: ID 1d6b:0002, will be unable to obtain all data: Access denied (insufficient permissions)\n  1   3 \uf287 0x8087 0x0a2b Bluetooth wireless interface                      12.0 Mb\/s\n  1   2 \uf287 0x5986 0x054c                                                  480.0 Mb\/s\n  1   4 \uf287 0x17ef 0x6047 ThinkPad Compact Keyboard with TrackPoint         12.0 Mb\/s\n  1   1 \uf17c 0x1d6b 0x0002 2.0 root hub                                     480.0 Mb\/s\n  2   1 \uf17c 0x1d6b 0x0003 3.0 root hub                                       5.0 Gb\/s<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">permission\u4e0d\u8db3\u3092sudo\u3067\u89e3\u6c7a<\/div>\n<div class=\"content\">\n<pre>$ sudo ~\/.cargo\/bin\/cyme\n  1   3 \uf287 0x8087 0x0a2b Bluetooth wireless interface                                12.0 Mb\/s\n  1   2 \uf287 0x5986 0x054c USB HD Webcam                                 200901010001 480.0 Mb\/s\n  1   4 \uf287 0x17ef 0x6047 ThinkPad Compact USB Keyboard with TrackPoint               12.0 Mb\/s\n  1   1 \uf17c 0x1d6b 0x0002 xHCI Host Controller                          0000:00:14.0 480.0 Mb\/s\n  2   1 \uf17c 0x1d6b 0x0003 xHCI Host Controller                          0000:00:14.0   5.0 Gb\/s<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">lsusb\u5f62\u5f0f<\/div>\n<div class=\"content\">\n<pre>$ cyme --lsusb\nFailed to open Bus 002 Device 001: ID 1d6b:0003, will be unable to obtain all data: Access denied (insufficient permissions)\nFailed to open Bus 001 Device 003: ID 8087:0a2b, will be unable to obtain all data: Access denied (insufficient permissions)\nFailed to open Bus 001 Device 002: ID 5986:054c, will be unable to obtain all data: Access denied (insufficient permissions)\nFailed to open Bus 001 Device 004: ID 17ef:6047, will be unable to obtain all data: Access denied (insufficient permissions)\nFailed to open Bus 001 Device 001: ID 1d6b:0002, will be unable to obtain all data: Access denied (insufficient permissions)\nBus 001 Device 003: ID 8087:0a2b Intel Corp. Bluetooth wireless interface\nBus 001 Device 002: ID 5986:054c Acer, Inc\nBus 001 Device 004: ID 17ef:6047 Lenovo ThinkPad Compact Keyboard with TrackPoint\nBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub\nBus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">\u6587\u5b57\u5316\u3051\u304c\u6c17\u306b\u306a\u308b\u306e\u3067 <code>--ascii<\/code> \u30aa\u30d7\u30b7\u30e7\u30f3\u3092<\/div>\n<div class=\"content\">\n<pre>$ sudo ~\/.cargo\/bin\/cyme --tree --ascii\n\/:  xHCI Host Controller Linux 6.0.0-6-amd64 xhci-hcd\n|__O   4 0x17ef 0x6047 ThinkPad Compact USB Keyboard with TrackPoint\n|__O   2 0x5986 0x054c USB HD Webcam                                 200901010001\n|__O   3 0x8087 0x0a2b Bluetooth wireless interface\n\n\/:  xHCI Host Controller Linux 6.0.0-6-amd64 xhci-hcd<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\"><code>--verbose<\/code> \u306f4\u3064\u307e\u3067\u52b9\u304f\u3088\u3046<\/div>\n<div class=\"content\">\n<pre>$ sudo ~\/.cargo\/bin\/cyme --ascii --vidpid 0x17ef:0x6047 --verbose --verbose --verbose | wc\n      6      39     271\n$ sudo ~\/.cargo\/bin\/cyme --ascii --vidpid 0x17ef:0x6047 --verbose --verbose --verbose --verbose | wc\n      6      56     389\n$ sudo ~\/.cargo\/bin\/cyme --ascii --vidpid 0x17ef:0x6047 --verbose --verbose --verbose --verbose --verbose | wc\n      6      56     389<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">filter<\/div>\n<div class=\"content\">\n<pre>$ sudo ~\/.cargo\/bin\/cyme --ascii --filter-name cam <b class=\"conum\">(1)<\/b>\n  1   2 0x5986 0x054c USB HD Webcam 200901010001 480.0 Mb\/s\n$ sudo ~\/.cargo\/bin\/cyme --ascii --filter-class hid <b class=\"conum\">(2)<\/b>\n$ sudo ~\/.cargo\/bin\/cyme --ascii --filter-serial 14 <b class=\"conum\">(3)<\/b>\n  1   1 0x1d6b 0x0002 xHCI Host Controller 0000:00:14.0 480.0 Mb\/s\n  2   1 0x1d6b 0x0003 xHCI Host Controller 0000:00:14.0   5.0 Gb\/s\n$ sudo ~\/.cargo\/bin\/cyme --ascii --vidpid 0x17ef:0x6047 <b class=\"conum\">(4)<\/b>\n  1   4 0x17ef 0x6047 ThinkPad Compact USB Keyboard with TrackPoint         12.0 Mb\/s<\/pre>\n<\/div>\n<\/div>\n<div class=\"colist arabic\">\n<ol>\n<li>\u6587\u5b57\u5217\u3067\u30d5\u30a3\u30eb\u30bf<\/li>\n<li>hid class \u3067\u30d5\u30a3\u30eb\u30bf\u2026\u2026\u3046\u307e\u304f\u3044\u304b\u306a\u3044?<\/li>\n<li>serial\u306e\u4e00\u90e8\u3067\u30d5\u30a3\u30eb\u30bf<\/li>\n<li>vid\/pid\u3067\u30d5\u30a3\u30eb\u30bf<\/li>\n<\/ol>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">\u3088\u304f\u4f7f\u3046 <code>sudo lsusb -d 17ef:6047 -vvv<\/code> \u306e\u4ee3\u308f\u308a?<\/div>\n<div class=\"content\">\n<pre>$ sudo ~\/.cargo\/bin\/cyme --ascii --vidpid 0x17ef:0x6047 --verbose --verbose --verbose --verbose --lsusb | head\n\nBus 001 Device 004: ID 17ef:6047 Lenovo ThinkPad Compact Keyboard with TrackPoint\nDevice Descriptor:\n  bcdUSB              2.00\n  bDeviceClass           0 UseInterfaceDescriptor\n  bDeviceSubClass        0\n  bDeviceProtocol        0\n  bMaxPacketSize0        8\n  idVendor          0x17ef Lenovo\n  idProduct         0x6047 ThinkPad Compact Keyboard with TrackPoint<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">uninstall<\/div>\n<div class=\"content\">\n<pre>$ cargo uninstall cyme\n    Removing \/home\/matoken\/.cargo\/bin\/cyme<\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>lsusb\u3067\u305d\u3046\u56f0\u3063\u3066\u3044\u307e\u305b\u3093\u304c\uff0ccyme\u306flsusb\u3068\u4e92\u63db\u6027\u304c\u3042\u308b\u3057\u898b\u305f\u76ee\u3082\u4eca\u3069\u304d\u306a\u611f\u3058\u306a\u306e\u3067\u826f\u3055\u305d\u3046\u3067\u3059\uff0e\u305f\u3060\u81ea\u5206\u3067\u5165\u308c\u3066\u307e\u3067\u4f7f\u3046\u304b\u3068\u3044\u3046\u3068\u5fae\u5999\uff0e\u30c7\u30a3\u30b9\u30c8\u30ea\u30d3\u30e5\u30fc\u30b7\u30e7\u30f3\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u5165\u3063\u305f\u3089\u4f7f\u3046\u304b\u3082\u3068\u3044\u3046\u611f\u3058\u3067\u3057\u3087\u3046\u304b\uff0e<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">\u74b0\u5883<\/div>\n<div class=\"content\">\n<pre>$ cyme --version\ncyme 1.2.1\n$ dpkg-query -W cargo libudev-dev\ncargo   0.63.1-3\nlibudev-dev:amd64       252.4-1\n$ lsb_release -a\nDistributor ID: Debian\nDescription:    Debian GNU\/Linux bookworm\/sid\nRelease:        n\/a\nCodename:       bookworm\n$ arch\nx86_64<\/pre>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>rust\u88fd\u306e\u30e2\u30c0\u30f3\u306alsusb\u7684\u306acyme\u3068\u3044\u3046\u3082\u306e\u3092\u898b\u304b\u3051\u305f\u306e\u3067\u5c11\u3057\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\uff0e cyme\u306flsusb\u3068\u3082\u4e92\u63db\u6027\u304c\u6709\u308a\uff0cLinux\/Windows\/macOS\u3067\u52d5\u4f5c\u3059\u308b\u3088\u3046\u3067\u3059\uff0e tuna-f1sh\/cyme: L [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"webmentions_disabled_pings":false,"webmentions_disabled":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[739,7,6],"tags":[745,744,168],"class_list":["post-3798","post","type-post","status-publish","format-standard","hentry","category-bookworm","category-debian-linux","category-linux","tag-cyme","tag-lsusb","tag-usb"],"_links":{"self":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/3798","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/comments?post=3798"}],"version-history":[{"count":2,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/3798\/revisions"}],"predecessor-version":[{"id":3800,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/3798\/revisions\/3800"}],"wp:attachment":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/media?parent=3798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/categories?post=3798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/tags?post=3798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}