这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@Danieljohn5051
Copy link

Facebook code

termux-usb -l now returns something like:

[
  {
    "device_name": "/dev/bus/usb/001/004",
    "device_id": 1004,
    "vendor_id": "0x0a12",
    "product_id": "0x0001",
    "device_class": "224 - Wireless controller device",
    "device_sub_class": 1,
    "manufacturer_name": null,
    "device_protocol": 1,
    "product_name": "CSR8510 A10",
    "serial_number": null,
    "configurations": 1,
    "descriptor_type": 0,
    "access_granted": false
  },
  {
    "device_name": "/dev/bus/usb/001/003",
    "device_id": 1003,
    "vendor_id": "0x0bda",
    "product_id": "0x8153",
    "device_class": "0 - Usb class is determined on a per-interface basis",
    "device_sub_class": 0,
    "manufacturer_name": "Realtek",
    "device_protocol": 0,
    "product_name": "USB 10/100/1000 LAN",
    "serial_number": "000000100000",
    "configurations": 2,
    "descriptor_type": 0,
    "access_granted": false
  }
]
Lets be consistent in how we put spaces.
So we can either pass `--es device /dev/bus/usb/001/003`, or
`--es vendorId 0x0403 --es productId 0x6001`.
Apparently some devices have fixed length fields, are extra nulls at
the end. This makes parsing the output slightly more annoying in
termux so strip them on the java side.

Before termux-usb -l could return something like:

[
  {
    "device_name": "/dev/bus/usb/002/006",
    "device_id": 2006,
    "vendor_id": "0x316d",
    "product_id": "0x4c4b",
    "device_class": "0 - Usb class is determined on a per-interface basis",
    "device_sub_class": 0,
    "manufacturer_name": "Purism, SPC\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
    "device_protocol": 0,
    "product_name": "Librem Key\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
    "serial_number": "00000000000000000000AB62",
    "configurations": 1,
    "descriptor_type": 0,
    "access_granted": false
  }
]

and now we remove all \u0000.
@termux termux deleted a comment from jameslacia May 31, 2023
@termux termux locked and limited conversation to collaborators May 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants