Skip to content

Instantly share code, notes, and snippets.

@karussell
Created January 25, 2017 19:36
Show Gist options
  • Save karussell/a44b824e314f59cfca0468a73bb8afc4 to your computer and use it in GitHub Desktop.
Save karussell/a44b824e314f59cfca0468a73bb8afc4 to your computer and use it in GitHub Desktop.
@karussell
Copy link
Author

karussell commented Jan 25, 2017

# Somehow copy&paste is messed up in the editor (?)

#!/bin/bash
# Author: Fran M.
# Before running this command you must give execution permissions to the file: chmod u+x mblock_wine.sh


if [ "$EUID" -ne 0 ]
  then echo "Run the command as root: sudo $0"
  exit
fi

if [[ -z "$SUDO_USER" ]] 
then
   SUDO_USER=$USER
fi

adduser $SUDO_USER dialout
usermod -a -G tty $SUDO_USER

echo 'KERNEL=="ttyUSB0", SUBSYSTEM=="tty", SUBSYSTEMS=="usb-serial", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="mbotUSB"' > /etc/udev/rules.d/mblock.rules


ln -s /dev/ttyUSB0 ~/.wine/dosdevices/com1

echo '[Hardware\\Devicemap\\Serialcomm] 1231984861' >> ~/.wine/system.reg
echo '"Serial0"="COM1"'>>~/.wine/system.reg

echo "Changes made ok. Yo must reboot the PC."

read -p "Reboot now? (Y/N) " sn
case $sn in
     [Yy]* ) reboot; break;;
     [Nn]* ) exit;;
esac

@karussell
Copy link
Author

Alternative possibility without root

#!/bin/bash

ln -s /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0 ~/.wine/dosdevices/com1
printf "\n\n[Hardware\\\Devicemap\\\Serialcomm] 1231984861\n\"Serial0\"=\"COM1\"\n" >> ~/.wine/system.reg
wine "C:\Program Files (x86)\mblock\mBlock.exe"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment