using Arduino development environment with Qubes OS

483 views
Skip to first unread message

pe...@peabo.com

unread,
Jul 17, 2016, 11:40:46 PM7/17/16
to qubes-users, pe...@peabo.com
I'm converting a machine I used for Arduino development to use Qubes.

The docs indicate support for USB stick, keyboard, and mouse.

I'm wondering if I can gain access to /dev/ttyACM0 or similar devices in a specific VM? This is a usual USB-to-serial interface used by Arduino.

Peter Olson

grzegorz....@gmail.com

unread,
Jul 21, 2016, 3:59:20 PM7/21/16
to qubes-users, pe...@peabo.com
Have You tried passing the USB controller to the VM? This should work pretty well.

jav.m...@gmail.com

unread,
Jan 21, 2017, 8:42:24 AM1/21/17
to qubes-users, pe...@peabo.com
My experience passing the USB controller to the VM is that I lost control of USB peripherals in dom0 (e.g. USB mouse) and it still did not notice the presence of my Arduino board inside the VM. By this, I mean that connecting and disconnecting the board did not produce any changes in the output of the commands

> dmesg

and

> lsusb

The connection also didn't add any new device to the /dev/tty* list.

dom0, instead, was able to detect that there was an Arduino connected to the laptop, and created the corresponding /dev/ttyACM0 device, but I can do nothing with it since I don't know how to propagate it to my VM.

Any ideas??

Thanks!

Javier

Gray Olson

unread,
Jan 21, 2017, 1:17:29 PM1/21/17
to qubes-users
Try a permissive pass through of the usb pci device https://www.qubes-os.org/doc/assigning-devices/

jav.m...@gmail.com

unread,
Jan 22, 2017, 6:27:32 AM1/22/17
to qubes-users
On Saturday, January 21, 2017 at 1:17:29 PM UTC-5, Gray Olson wrote:
> Try a permissive pass through of the usb pci device https://www.qubes-os.org/doc/assigning-devices/

Thanks a lot Gray, there is a lot of new information in the documentation indeed:

I went around the problem in a different way, which I describe here for future reference:

First open a terminal in your TemplateVM (fedora-23 in my case) and type:

> groups

if dialout does not appear listed you can either type

> sudo gpasswd --add user dialout

or

> sudo usermod -aG dialout user

Either way. it will give you access to the dialout group in order to make use of the /dev/tty* communication devices inside VMs that depend on that Template. But you must restart the Template VM in order to see a change in the output of the command: "> groups", since the groups information is only loaded at login.

Finally, it is reported (https://www.qubes-os.org/doc/usb/#attaching-a-single-usb-device-to-a-qube-usb-passthrough) that with Qubes 3.2 it is now possible to give access to any USB device to a VM from dom0.

It goes as follows:

Assuming that you have not created yet a USB qube (it's a VM usually named: sys-usb) you can create one in two easy steps, by typing in dom0:

> qubesctl top.enable qvm.sys-usb

> qubesctl state.highstate

From now on your dom0 environment is protected from direct contact with any USB device and they are directly attached to the sys-usb VM. Now, what you can do after starting sys-usb, is to transfer the device from that VM to another one, lets say "work" VM:

First identify it from a terminal in dom0,

> qvm-usb
sys-usb:3-2 2341:0043 Arduino__www.arduino.cc__0043...

and then attach it to your ALREADY STARTED "work" VM,

>qvm-usb -a work sys-usb:3-2

The final check is to open a terminal in your "work" VM and type in there:

> lsusb

and

> ls -l /dev/ttyACM0

both outputs should tell you that there is a device connected to your VM.


Cheers,

Javier

Reply all
Reply to author
Forward
0 new messages