[Support] kilrah/arduinoide2-vnc


Kilrah

Recommended Posts

Project: https://www.arduino.cc/
Custom image used for this template: https://hub.docker.com/repository/docker/kilrah/arduinoide2-vnc

Source: https://github.com/kilrah/docker-templates

 

Arduino IDE 2 as a container. Allows sharing a dev environment wherever you are instead of battling with libraries / dealing with slow compilation on Windows

 

Only boards that appear as serial ports and do not do fancy stuff like disconnecting to reconnect as HID for their bootloader will work for programming, but those that work will do so even when bound via USBIP.

A web browser (firefox), file browser with archive support (thunar), terminal (xfce4-terminal), generic text editor (geany) and git are provided to get your codez in/out.
Use the right mouse button in the empty "desktop" (unmaximize window if necessary) to bring up the app menu, and the middle mouse button for a task switcher.

Use /mnt/cache/appdata paths instead of /mnt/user/appdata if you have an SSD cache, performance is tremendously improved.


Very beta and probably does lots of things you shouldn't do in Docker, but works. Probably don't expose to the internet...

 

See below for configuration/connection details.

 

IMG_20221120_120218.thumb.jpg.332e3caa77639d5d2395fb8eedeb72db.jpg

Edited by Kilrah
  • Like 1
Link to comment

Local connection

 

Connect your board to your server's USB port. Use the terminal to find out the device:

 

ls -l /dev/tty*

 

You should find something at the bottom, usually /dev/ttyACM0 or /dev/ttyUSB0. 

In the template set Device to this.

If you have multiple you can add more Devices to the template, but note that the container will not start if a non-existing device is specified so you will likely need to frequently edit the template as you connect different boards.

 

Remote connection

 

Boards can also be connected remotely through USBIP. You can be working on a laptop accessing this container via a browser, and flash a board connected to your laptop.

 

For that, start by installing the requirements on Unraid side:

  • Install the "USB Manager" plugin.
  • Go to Settings -> USB Devices, click the cog on the top right to access the settings

         image.png.0e42e1322f289610607f0986aa286076.png

  • Enable "Enable USBIP", Install the addon plugin, select Yes to both entries under "Load Kernel Modules", enable the USBIPD Daemon

 

        image.thumb.png.59263fd5601a2b369d2f7895cadb8707.png

 

Then on the remote side:

 

  • Install USBIPD. 

        Windows: https://github.com/dorssel/usbipd-win

        Linux: USBIPD should be part of your distro's linux-tools-generic package, install if not present. 

 

  • Use an Administrator terminal on Windows / sudo on linux to list and bind the device

         usbipd list (Windows)

         usbip list -l (Linux)

 

  • Linux only:
    • load the usbip kernel modules

                 sudo modprobe usbip_core

                 sudo modprobe usbip_host

                 Modules need relaoding after each reboot, alternatively you can set them to autoload, see e.g.

                 https://www.cyberciti.biz/faq/linux-how-to-load-a-kernel-module-automatically-at-boot-time/

 

                 Start the usbipd daemon: sudo usbipd -D

 

  • Find the bus id of your device in the list, then bind it, e.g.

        usbipd bind -b 3-2 (Windows)

        sudo usbip bind -b 3-2 (Linux)

       

Finally connect unraid to the device:

On the USB page Unraid should find the remote server and list its devices. If not click "Add remote system" and search for servers.

 

image.png.bcedfa1b84c9c4d9ebcc862c696ad5c6.png

 

Click Attach. The device will now be presented to Unraid in the same was as if it was physically connected, so you can follow the "Local Connection" section to find it and bind it to the container.

Note that when using USBIP you may need to reduce the upload speed in Arduino IDE if the connection is unreliable. It may or may not work when used on remote networks, it's fine locally whether wired or through Wi-Fi, but for example VPNed in from a mobile connection added too much latency, the device is seen but upload just always fails. 

 

Note that at least the Windows daemon rememebers bindings, so don't forget to unbind the device if you want to use it locally again. 

Edited by Kilrah
Link to comment
On 11/21/2022 at 8:26 AM, gekoch said:

Is it possible to set PUID and GUID since I need to write into a folder where all my sketches are that have a certain permission

I think I got that working. 

If you specify PUID/PGID environment variables those will be used in the container. Note that it will take ownership of the entire appdata folder and contents, since Arduino IDE stores all its config and libraries there it needs to be able to access them. 

I would still recommend making copies of the sketches into the folder instead of building a whole environment in random folders.

Link to comment
3 minutes ago, Kilrah said:

I think I got that working. 

If you specify PUID/PGID environment variables those will be used in the container. Note that it will take ownership of the entire appdata folder and contents, since Arduino IDE stores all its config and libraries there it needs to be able to access them. 

I would still recommend making copies of the sketches into the folder instead of building a whole environment in random folders.

 

ok thx will try it

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.