Last active
April 23, 2017 21:59
-
-
Save eulersson/d355a1768d8b88bd1372a9939e6a798f to your computer and use it in GitHub Desktop.
Using Android as RPi display
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ============================================================================= | |
# ANDROID AS DISPLAY SCREEN FOR RASPBERRY PI | |
# ============================================================================= | |
# Sets VNC so you can use your Android phone as display for Raspberry Pi. If | |
# you plug it via USB and use USB Tethering and install the required things | |
# (following steps in this file) it should work. | |
# | |
# Following this resources: | |
# https://www.raspberrypi.org/forums/viewtopic.php?f=41&t=127971 | |
# http://rageweb.info/2013/11/07/bootconfig-txt-in-kali/ | |
# | |
# WARNING: I would not run directly this script, it's better to | |
# copy, paste and run the lines progressively to avoid big mess. | |
echo "Modifying network interfaces file" | |
interfacesfile=/etc/network/interfaces | |
sudo echo "" >> $interfacesfile | |
sudo echo "allow-hotplug usb0" >> $interfacesfile | |
sudo echo "auto usb" >> $interfacesfile | |
sudo echo "iface usb0 inet static" >> $interfacesfile | |
sudo echo "address 192.168.42.42" >> $interfacesfile | |
sudo echo "netmask 255.255.255.0" >> $interfacesfile | |
sudo echo "network 192.168.42.0" >> $interfacesfile | |
sudo echo "broadcast 192.168.42.255" >> $interfacesfile | |
echo "Installing x11vnc" | |
sudo apt-get install x11vnc | |
echo "Setting password for x11vnc, you will have to input it" | |
x11vnc -storepasswd | |
echo "Creating folders ~/.config/autostart" | |
mkdir -p ~/.config/autostart | |
cd ~/.config/autostart | |
echo "Creating x11vnc.desktop" | |
touch x11vnc.desktop | |
echo "[Desktop Entry]" >> x11vnc.desktop | |
echo "Encoding=UTF-8" >> x11vnc.desktop | |
echo "Type=Application" >> x11vnc.desktop | |
echo "Name=X11VNC" >> x11vnc.desktop | |
echo "Comment=" >> x11vnc.desktop | |
echo "Exec=x11vnc -forever -usepw -display :0 -ultrafilexfer" >> x11vnc.desktop | |
echo "StartupNotify=false" >> x11vnc.desktop | |
echo "Terminal=false" >> x11vnc.desktop | |
echo "Hidden=false" >> x11vnc.desktop | |
# In case of Raspbian Jessie with Pixel | |
sudo sed 's/#framebuffer_width=.*/framebuffer_width=1280/' /boot/config.txt | |
sudo sed 's/#framebuffer_height=.*/framebuffer_height=720/' /boot/config.txt | |
sudo sed 's/#hdmi_set_hotplug=.*/hdmi_set_hotplug=1/' /boot/config.txt | |
sudo sed 's/#hdmi_group=.*/hdmi_group=2/' /boot/config.txt | |
sudo sed 's/#hdmi_mode=.*/hdmi_mode=16/' /boot/config.txt | |
# In case of Kali, the config.txt file is different. You | |
# need to mount the bios partition first and create the config | |
# file there first. | |
mkdir /fat32 | |
mount /dev/mmcblk0p1 /fat32/ | |
cd /fat32 | |
touch config.txt | |
echo "framebuffer_width=1280" >> config.txt | |
echo "framebuffer_height=720" >> config.txt | |
echo "hdmi_group=2" >> config.txt | |
echo "hdmi_mode=16" >> config.txt | |
umount /fat32 | |
echo "All ready!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment