what is neat the Arduino MEGA 2560 comes with UART/Serial-USB-Adapter ON BOARD and is powered by USB at the same time.

so no need for extra Serial-UART-adapter and fancy wiring.

usb passthrough: yes – one can USB-connect arduino to a virtualbox 🙂

like to have a virtualbox vm dedicated for every purpose of development.

one can pass through the arduino MEGA 2560 to virtualbox vm like this:

when using one’s nice colorful monitoring script, one can see this output:

# tested on
hostnamectl 
   Static hostname: debian
         Icon name: computer-vm
           Chassis: vm
    Virtualization: oracle
  Operating System: Debian GNU/Linux 9 (stretch)
            Kernel: Linux 4.9.0-9-amd64
      Architecture: x86-64

==> /var/log/kern.log <== 
Nov 23 15:37:48 debian kernel: [  763.800669] usb 1-2: new full-speed USB device number 4 using ohci-pci 
Nov 23 15:37:49 debian kernel: [  764.155998] usb 1-2: New USB device found, idVendor=2341, idProduct=0042 
Nov 23 15:37:49 debian kernel: [  764.156000] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=220 
Nov 23 15:37:49 debian kernel: [  764.156002] usb 1-2: Manufacturer: Arduino (www.arduino.cc) 
Nov 23 15:37:49 debian kernel: [  764.156003] usb 1-2: SerialNumber: 85235333139282728282 
Nov 23 15:37:49 debian kernel: [  764.160494] cdc_acm 1-2:1.0: ttyACM0: USB ACM device 

==> /var/log/messages <== 
Nov 23 15:37:48 debian kernel: [  763.800669] usb 1-2: new full-speed USB device number 4 using ohci-pci 
Nov 23 15:37:49 debian kernel: [  764.155998] usb 1-2: New USB device found, idVendor=2341, idProduct=0042 
Nov 23 15:37:49 debian kernel: [  764.156000] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=220 
Nov 23 15:37:49 debian kernel: [  764.156002] usb 1-2: Manufacturer: Arduino (www.arduino.cc) 
Nov 23 15:37:49 debian kernel: [  764.156003] usb 1-2: SerialNumber: 85235333139282728282 
Nov 23 15:37:49 debian kernel: [  764.160494] cdc_acm 1-2:1.0: ttyACM0: USB ACM device 
Nov 23 15:37:49 debian mtp-probe: checking bus 1, device 4: "/sys/devices/pci0000:00/0000:00:06.0/usb1/1-2" 
Nov 23 15:37:49 debian mtp-probe: bus: 1, device: 4 was not an MTP device 

==> /var/log/syslog <== 
Nov 23 15:37:48 debian kernel: [  763.800669] usb 1-2: new full-speed USB device number 4 using ohci-pci 
Nov 23 15:37:49 debian kernel: [  764.155998] usb 1-2: New USB device found, idVendor=2341, idProduct=0042 
Nov 23 15:37:49 debian kernel: [  764.156000] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=220 
Nov 23 15:37:49 debian kernel: [  764.156002] usb 1-2: Manufacturer: Arduino (www.arduino.cc) 
Nov 23 15:37:49 debian kernel: [  764.156003] usb 1-2: SerialNumber: 85235333139282728282 
Nov 23 15:37:49 debian kernel: [  764.160494] cdc_acm 1-2:1.0: ttyACM0: USB ACM device 
Nov 23 15:37:49 debian mtp-probe: checking bus 1, device 4: "/sys/devices/pci0000:00/0000:00:06.0/usb1/1-2" 
Nov 23 15:37:49 debian mtp-probe: bus: 1, device: 4 was not an MTP device 

==> /var/log/user.log <== 
Nov 23 15:37:49 debian mtp-probe: checking bus 1, device 4: "/sys/devices/pci0000:00/0000:00:06.0/usb1/1-2" 
Nov 23 15:37:49 debian mtp-probe: bus: 1, device: 4 was not an MTP device 

the problem:

starts when one tries to upload a program it said:

Sketch uses 656 bytes (0%) of program storage space. Maximum is 253952 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 8183 bytes for local variables. Maximum is 8192 bytes.
avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied
ioctl("TIOCMGET"): Inappropriate ioctl for device
ioctl("TIOCMGET"): Inappropriate ioctl for device
avrdude: ser_send(): write error: Bad file descriptor
avrdude: stk500_send(): failed to send command to serial port
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: Bad file descriptor
avrdude: stk500_send(): failed to send command to serial port
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: Bad file descriptor
avrdude: stk500_send(): failed to send command to serial port

solution:

just give read and write access to everyone on this USB device.

chmod a+rw /dev/ttyACM0

ceditz: this guy: https://www.youtube.com/watch?v=iyQgmmtIAXQ

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin