New issue
Advanced search Search tips

Issue 719705 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Feature


Participants' hotlists:
USB


Sign in to add a comment

Generate USB Device names when unavailable.

Reported by k...@karelbilek.com, May 8 2017

Issue description

Converted to a Feature request to bring our desktop code that generates device names onto all platforms.

====
original bug report:

Steps to reproduce the problem:
1. Connect our device to android with USB cable
2. Open Chrome (with WebUSB enabled in flags)
3. Run the above linked code

document.querySelector("#letsride").onclick = function() {
navigator.usb.requestDevice({ filters: [{ vendorId: 0x534c }] })
}

Our device has vendor ID 0x534c and device ID 0x0001. We have "TREZOR" in iProduct in USB descriptor. (see https://github.com/trezor/trezor-mcu/blob/master/firmware/usb.c#L68 and https://usb-ids.gowdy.us/read/UD/534c )

What is the expected behavior?
The device should be listed the same way as on Linux - with the name "TREZOR"; or at least "USB device" etc; or at least show some name.

I cannot test right now on other devices, but on Linux, it correctly shows "TREZOR" name.

What went wrong?
The chooser shows an "empty" list; actually, it's one line, but with an empty string.

The first line is actually clickable; I can select it correctly. After selecting it and clicking "connect", it works as it should.

See attached screenshot.

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 58.0.3029.83  Channel: stable
OS Version: 4.4.4
Flash Version:
 
chromebug.html
207 bytes View Download
Screenshot_2017-05-08-22-57-17.jpeg
52.7 KB View Download
This is how the line looks selected
Screenshot_2017-05-08-23-19-40.jpeg
64.7 KB View Download

Comment 2 by rusn...@gmail.com, May 9 2017

I can see the label correctly, so I think this is a kernel issue, not browser issue. (I have kernel 3.4.0 on Android 6.0.1)
If you visit chrome://device-log is the string after product=$DEVICE_PID empty?

We get this string directly from UsbDevice.getProductName() in the Android SDK so if it's empty there's not much I can do about it unless I follow through on my plan to bypass even more of the standard SDK when enumerating devices.

Comment 4 by k...@karelbilek.com, May 11 2017

USBUser[13:07:34] USB device added: id=1002 vendor=21324 "", product=1 "", serial="", guid=ad03e5a6-5ee0-4c7f-a5db-dfb87bf29f70

Yep, it's empty. So it's probably an old kernel issue.

I would be OK in this case if it didn't show the product name correctly, but if it at least showed "unrecognized USB device" or something similar. 

When I connect the device normally, it shows something like "Use application XY for this device" (without showing me the device name) - so something like that.

Comment 5 by k...@karelbilek.com, May 11 2017

This just doesn't look like a list, since it's not obvious the empty line is clickable
Labels: -Pri-2 Pri-3
Asking the user for permission to access "unrecognized device" isn't good from a security perspective. We have a fallback vendor and product ID list but in some cases we may have to filter out devices that we do not have names for.

Comment 7 by k...@karelbilek.com, May 12 2017

I am not sure what is the best solution. 

Of course the best solution would be if Android was auto-updating and you wouldn't be stuck with devices with old kernels, but that's not a Chrome issue :) 

Comment 8 by scheib@chromium.org, Sep 13 2017

Labels: -Type-Bug Type-Feature
Status: Available (was: Unconfirmed)
Summary: Generate USB Device names when unavailable. (was: Device chooser shows empty device name)
Considering this a feature request to generate device names on mobile when they are not available.  (This is already implemented on desktop -reillyg)  Adding to USB backlog.

Comment 9 by scheib@chromium.org, Sep 13 2017

Description: Show this description
Cc: reillyg@chromium.org
Owner: juncai@chromium.org
Status: Assigned (was: Available)
Status: Started (was: Assigned)
Project Member

Comment 12 by bugdroid1@chromium.org, Oct 4 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/86418ddb96cf94734aecb85ff60e8819b07d697b

commit 86418ddb96cf94734aecb85ff60e8819b07d697b
Author: Jun Cai <juncai@chromium.org>
Date: Wed Oct 04 00:47:03 2017

Generate USB device name when unavailable (on Android)

This CL adds code to generate USB device name when its original name is
empty. This is already implemented for WebUSB desktop chooser, so this
CL follows the same pattern as the desktop implementation.

Bug:  719705 
Change-Id: I4c6307aee3cf61aa3b0668c8966fc9e8ce44e3cb
Reviewed-on: https://chromium-review.googlesource.com/678035
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Commit-Queue: Jun Cai <juncai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506255}
[modify] https://crrev.com/86418ddb96cf94734aecb85ff60e8819b07d697b/chrome/app/generated_resources.grd
[modify] https://crrev.com/86418ddb96cf94734aecb85ff60e8819b07d697b/chrome/browser/BUILD.gn
[modify] https://crrev.com/86418ddb96cf94734aecb85ff60e8819b07d697b/chrome/browser/ui/android/usb_chooser_dialog_android.cc
[modify] https://crrev.com/86418ddb96cf94734aecb85ff60e8819b07d697b/chrome/browser/usb/usb_chooser_controller.cc
[add] https://crrev.com/86418ddb96cf94734aecb85ff60e8819b07d697b/chrome/browser/usb/usb_util.cc
[add] https://crrev.com/86418ddb96cf94734aecb85ff60e8819b07d697b/chrome/browser/usb/usb_util.h

Status: Fixed (was: Started)

Sign in to add a comment