New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 831850 link

Starred by 156 users

Issue metadata

Status: Assigned
Owner:
User never visited
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug

Restricted
  • Only users with EditIssue permission may comment.


Show other hotlists

Hotlists containing this issue:
Chromium-bugs-related-to-Crostini


Sign in to add a comment

Enable USB emulation in crosvm

Project Member Reported by dgreid@chromium.org, Apr 11 2018

Issue description

Allow USB devices to be accessed from VMs.

Devices must be allowed by permission broker.

This will allow things like USB JTAG and android phones w/ adb to work.
 

Comment 1 by dinv...@gmail.com, Apr 15 2018

This would be a huge bonus to using crosvm. Devices like phones, flash drives, printers, scanners, YubiKeys etc. would greatly expand use cases of these VMs.
LXD upstream here. :)
This would also work nicely with containers. LXD can dynamically add devices to running containers. Once good example are usb devices. Essentially you can tell LXD to listen for a uevent for a specific usb device or even all usb devices from a specific vendor:

lxc config device add <container-name> <device-name> usb vendorid=<id> productid=<id>

Here is a demo that dynamically adds my Android phone to my LXD container and connects to it via adb devices:

https://asciinema.org/a/171520

I've also done some kernel work to support injecting uevents into containers starting with kernel 4.17. Since LXD runs system containers you can then even setup specific udev rules in the container and have them processed by udevd or in the case of Android ueventd.
When you're running unprivileged containers you won't be able to create device nodes yourself but that is - at least on new kernels - the job of devtmpfs anyway. And for unprivileged containers LXD will take care to create and inject the devices nodes into the container.
Status: Available (was: Untriaged)
Labels: Hotlist-Crostini-Platform
Hopefully this will aso enable serial USB devices. This would be a great boost for the education market, enabling Arduino development from Chromebooks.
Would really like to be able to run the Arduino programmer and program devices on my C101!
For what it's worth, and off-topic to the discussion in general to some extent... but... to the last poster, do you know about WebUSB?

There is a Chrome app called Chromeduino that has an IDE and lets you work with an Arduino from ChromeOS natively: https://chrome.google.com/webstore/detail/chromeduino2/llclpgogfbmiicabgcfbndeokekmggpm

More details here: https://github.com/spaceneedle/Chromeduino

However, there is also an official "Web Editor" for Arduino too: 
https://create.arduino.cc/projecthub/Arduino_Genuino/getting-started-with-arduino-web-editor-on-various-platforms-4b3e4a?f=1

Anyway, it would still be good to have proper USB pass-through support for containers/VMs.

We have it for Android via this flag: chrome://flags/#arc-usb-host so maybe that will help you get by for now on your Chromebook, if it supports Android apps that is.
Need to be able to use ARM M0 and non standard board type for my boat's wind instrument.  It's a very specific use case but one of the last reasons why a Chromebook has to be set aside from time to time to use something a bit more mainstream. I really appreciate the tips and am loving the pace of advancement that chromeOS has been receiving. 
My mistake about the official editor... it needs some third party plugin: https://github.com/arduino/arduino-create-agent

So that won't work, but give Chromeduino a try!
Also it would be really cool to be able to use USB to read from dive computers on Android apps. Hopefully also there would be a way to use either the Android or Linux version of Subsurface to talk to a BLE based computer too. Unfortunately at the moment my Chromebook doesn't work with the Android version yet. That and divemate can't see the USB port at all when connecting my older dive computer. 
Also found this, if your email was visible here I'd send it separate from this thread, apologies all...

https://codebender.cc/static/plugin

There's also this thing for ARM devices: https://os.mbed.com/docs/v5.9/tools/arm-mbed-online-compiler.html
But being on a boat, I could see how you definitely might not always have reliable internet access... a native offline solution would be ideal, for sure.
It should be pointed out that Chrome packaged apps have always had access to a serial USB ÀPI and the Espruino has IDE app makes use of it to allow programming a variety of Arm M3 based boards: https://www.espruino.com/Web+IDE
Note, though, that also uses a third party server for compilation, so you need network access to use it.

https://github.com/espruino/EspruinoTools/blob/f08b6bb6556c3114758539ae1153acd58f343d28/plugins/compiler.js
No, that's only to selectively compile JS into native code, a completely optional feature, you can use Espruino to program compatible boards with your Chromebook completely offline.
Actually that's some kind of JS compiler... literally turning JS into native code, not a C++ compiler, and it's using some kind of proprietary Espurino libraries.

It might do assembly compilation though...

https://github.com/espruino/EspruinoTools/blob/f08b6bb6556c3114758539ae1153acd58f343d28/plugins/assembler.js


So you're saying this will let you push bytecode or compile c++ to any ARM M3 microcontroller? I am suspicious... I think you need to be running their firmware on your board for it to work, no?
AFAICT that is running JS on your microcontroller using their libraries, not compiling C++.
This thing runs an M0 so it should be possible, in theory to get your board to work: http://www.espruino.com/MicroBit

Yes, absolutely, Espruino IDE is only for communicating with boards running Espruino firmware, I was simply using it to point out the availability and usability of serial USB APIs for Chrome Packaged Apps and so hopefully means there are no big issues such as security to prevent containers getting access.
Labels: Restrict-AddIssueComment-EditIssue
sorry, but this isn't the place for getting support for using various embedded devices.  please use other forums instead.  this bug is only about USB emulation in crosvm and what it'll take to enable that.
Owner: jkwang@chromium.org
Project Member

Comment 22 by bugdroid1@chromium.org, Jul 28

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/crosvm/+/c1ce54a9dd832ec8c71e49b09b1e4e7a67ede7b6

commit c1ce54a9dd832ec8c71e49b09b1e4e7a67ede7b6
Author: Jingkui Wang <jkwang@google.com>
Date: Sat Jul 28 02:11:15 2018

pci: Add serial bus subclass

Add serial bus subclass

BUG=chromium:831850
TEST=cargo test

Change-Id: Iffd7a27b5cb423c928f0108b16fb58558cf7bcd4
Reviewed-on: https://chromium-review.googlesource.com/1152212
Commit-Ready: Jingkui Wang <jkwang@google.com>
Tested-by: Jingkui Wang <jkwang@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/c1ce54a9dd832ec8c71e49b09b1e4e7a67ede7b6/devices/src/pci/pci_configuration.rs

Status: Assigned (was: Available)
Project Member

Comment 24 by bugdroid1@chromium.org, Aug 3

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/785a41eaf185078abf3e1a779134356ea297e0a0

commit 785a41eaf185078abf3e1a779134356ea297e0a0
Author: Jingkui Wang <jkwang@google.com>
Date: Fri Aug 03 04:50:21 2018

crosvm: add pkg-config

Add pkg-config to crosvm ebuild.

BUG=chromium:831850
TEST=local build

Change-Id: I3886de9c290beb8192e6e59273174d022b550ae7
Reviewed-on: https://chromium-review.googlesource.com/1161220
Commit-Ready: Jingkui Wang <jkwang@google.com>
Tested-by: Jingkui Wang <jkwang@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>

[modify] https://crrev.com/785a41eaf185078abf3e1a779134356ea297e0a0/chromeos-base/crosvm/Manifest
[modify] https://crrev.com/785a41eaf185078abf3e1a779134356ea297e0a0/chromeos-base/crosvm/crosvm-9999.ebuild

Project Member

Comment 25 by bugdroid1@chromium.org, Aug 7

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/crosvm/+/eba6e7f9bdbb521b285b676ff0c34ba79ee8e0db

commit eba6e7f9bdbb521b285b676ff0c34ba79ee8e0db
Author: Jingkui Wang <jkwang@google.com>
Date: Tue Aug 07 05:11:30 2018

sys_util: enable custom events in pollcontext

Can specify events for epoll now.

BUG=chromium:831850
TEST=local build

Change-Id: Iad418b5e9570b38fd8033276bf02ee3eb96d0d77
Reviewed-on: https://chromium-review.googlesource.com/1125293
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Jingkui Wang <jkwang@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>

[modify] https://crrev.com/eba6e7f9bdbb521b285b676ff0c34ba79ee8e0db/sys_util/src/poll.rs

Project Member

Comment 26 by bugdroid1@chromium.org, Aug 7

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/crosvm/+/f226e28632d95c8b3c8d90fbaaef1eda8509fc74

commit f226e28632d95c8b3c8d90fbaaef1eda8509fc74
Author: Jingkui Wang <jkwang@google.com>
Date: Tue Aug 07 08:51:08 2018

bitfield: Add fmt::Debug

implements fmt::Debug for bitfield

BUG=chromium:831850
TEST=cargo test

Change-Id: I58c2211a50726aaea0ea45164ae07c7b38eddea7
Reviewed-on: https://chromium-review.googlesource.com/1147111
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Jingkui Wang <jkwang@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>

[modify] https://crrev.com/f226e28632d95c8b3c8d90fbaaef1eda8509fc74/bit_field/bit_field_derive/bit_field_derive.rs

Labels: -M-69 M-71
Cc: msnoxell@chromium.org
Project Member

Comment 29 by bugdroid1@chromium.org, Aug 29

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/crosvm/+/b47c6925fb7a82696af2dae16dbde06863d584c4

commit b47c6925fb7a82696af2dae16dbde06863d584c4
Author: Jingkui Wang <jkwang@google.com>
Date: Wed Aug 29 18:16:14 2018

Remove sync requirements of pci device trait

It's not needed.

BUG=chromium:831850
TEST=cargo test

Change-Id: I7e38590271ec14db422f5f3421302e98a2ca19ab
Reviewed-on: https://chromium-review.googlesource.com/1194317
Commit-Ready: Jingkui Wang <jkwang@google.com>
Tested-by: Jingkui Wang <jkwang@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/b47c6925fb7a82696af2dae16dbde06863d584c4/devices/src/pci/pci_device.rs

for visibility, we've got a new USBGuard feature making it's way onto CrOS systems that might intersect with this functionality:
  http://doc/1wstNeVI62Eh6Rm6zqszHpiZphbxAoVGybsvbKGpYjXQ
  http://slides/1TjoXYlkIPGIxB6xBA0Fhu5RR8eJJULwtiyHgvu3bu1Y

i don't think we need to actively design for it atm, but something to keep in mind that might crop up at some point
Project Member

Comment 31 by bugdroid1@chromium.org, Today (18 hours ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/45c18df6fb9b38637c58be19bc6a7556c0ae51cb

commit 45c18df6fb9b38637c58be19bc6a7556c0ae51cb
Author: Jingkui Wang <jkwang@google.com>
Date: Fri Nov 16 13:02:02 2018

app-emulation/lxd: patch lxd to allow passing all usb

Use the following command to pass in all usb:
 lxc config device add <container name> <device name> usb

BUG=chromium:831850
TEST=cargo test

Change-Id: Ib66769398b8244149669c745d4fb3d657775f843
Reviewed-on: https://chromium-review.googlesource.com/1338156
Commit-Ready: Jingkui Wang <jkwang@google.com>
Tested-by: Jingkui Wang <jkwang@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>

[rename] https://crrev.com/45c18df6fb9b38637c58be19bc6a7556c0ae51cb/app-emulation/lxd/lxd-3.0.2-r4.ebuild
[add] https://crrev.com/45c18df6fb9b38637c58be19bc6a7556c0ae51cb/app-emulation/lxd/files/lxd-3.0.2-pass-all-usb.patch
[modify] https://crrev.com/45c18df6fb9b38637c58be19bc6a7556c0ae51cb/app-emulation/lxd/lxd-3.0.2.ebuild

Sign in to add a comment