aquaballoon

Lenovo Yoga 13 Setup

Jun 14th, 2014
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 7.91 KB | None | 0 0
  1. ## http://doc.ubuntu-fr.org/lenovo_yoga_13
  2. ## https://github.com/snaiffer/tabletMode
  3. ## https://github.com/pfps/yoga-laptop
  4.  
  5. // yoga-laptop install // https://github.com/pfps/yoga-laptop
  6. sudo apt-get install libxrandr-devel
  7.  
  8. // dirvers
  9. git clone https://github.com/pfps/yoga-laptop.git
  10. cd yoga-laptop
  11.  
  12. make ideapad-laptop
  13. sudo make ideapad-laptop-install
  14.  
  15. make sensors-drivers
  16. sudo make sensors-drivers-install
  17.  
  18. make programs
  19. sudo make programs-install
  20.  
  21. sudo nano /etc/sudoers
  22. ALL ALL=NOPASSWD: /usr/bin/orientation
  23.  
  24. //  Wireless
  25. Download source (zip) from here......
  26. https://github.com/lwfinger/rtl8723au
  27. https://github.com/lwfinger/rtl8723au/archive/master.zip
  28.  
  29. cd rtl8723au-master
  30. make
  31. sudo make install
  32. sudo modprobe 8723au
  33.  
  34.  
  35. // Brightness
  36. sudo gedit /etc/default/grub
  37.  
  38. GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
  39. Change it to:
  40.  
  41. GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor"
  42.  
  43. sudo update-grub
  44.  
  45. nano /etc/modprobe.d/blacklist.conf
  46. blacklist ideapad_laptop
  47.  
  48.  
  49. // SSD config
  50. sudo gedit /etc/fstab  
  51. ## add "noatime" to the line for root partition
  52. UUID=f0ae2c59-83d2-42e7-81c4-2e870b6b255d   /   ext4 noatime,errors=remount-ro   0   1
  53.  
  54. sudo gedit  /etc/rc.local
  55. #!/bin/sh -e
  56. # rc.local
  57. fstrim -v /
  58. fstrim -v /home
  59. exit 0
  60.  
  61. sudo mv -v /etc/cron.weekly/fstrim /fstrim
  62.  
  63. // Touchpad config
  64. $ xinput list
  65. $ xinput list-props "SynPS/2 Synaptics TouchPad"
  66. ## Sets the pressure [FingerLow FingerHigh FingerPress] -> default [25 30 256]
  67. Synaptics Finger (290): 25, 30, 0
  68. Synaptics Noise Cancellation (323): 8, 8
  69.  
  70. $ xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Finger" 35 40 256  ## or, 55 60 255
  71. $ xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Noise Cancellation" 24 24  ## or, 20 20
  72.  
  73.  
  74. // Closing the lid doesn’t always send the laptop to suspend, this is how to fix
  75. /etc/rc.local
  76.  
  77. # Disable wake up on anything for Yoga Pro 2, otherwise it sometimes wakes from suspend
  78. cat /proc/acpi/wakeup |
  79.     grep '*enabled' |
  80.     cut -f 1 -d ' ' |
  81.     xargs -n 1 -I {} sh -c 'echo Disabling wake up on {}... && echo {} > /proc/acpi/wakeup'
  82.  
  83.  
  84. // Adjust the trackpad
  85. nano /usr/share/X11/xorg.conf.d/50-synaptics.conf
  86.  
  87. Section "InputClass"
  88.         Identifier "touchpad catchall"
  89.         Driver "synaptics"
  90.         MatchIsTouchpad "on"
  91. # This option is recommend on all Linux systems using evdev, but cannot be
  92. # enabled by default. See the following link for details:
  93. # http://who-t.blogspot.com/2010/11/how-to-ignore-configuration-errors.html
  94.       MatchDevicePath "/dev/input/event*"
  95.  
  96.     Option "FingerLow"              "46"
  97.     Option "FingerHigh"             "46"
  98.     Option "ClickFinger1"           "1"
  99.     Option "ClickFinger2"           "2"
  100.     Option "ClickFinger3"           "3"
  101.     Option "TapButton1"             "1"
  102.     Option "TapButton2"             "3"
  103.     Option "TapButton3"             "2"
  104.     Option "AreaBottomEdge"         "85%"
  105.     Option "SoftButtonAreas"        "60% 0 85% 0 40% 60% 85% 0" # Btn2 LRTB - Btn3 LRTB
  106.     Option "EmulateMidButtonTime"   "75"
  107. EndSection
  108.  
  109.  
  110. // Enable some extra power save settings
  111. nano /etc/rc.local
  112.  
  113. # tune all power save settings to >good<
  114. powertop --auto-tune
  115. # all power save settings are fine but the one for the touchpad
  116. # disable powertop >good<-setting for touchpad
  117. echo 'on' > '/sys/bus/usb/devices/2-7/power/control'
  118.  
  119.  
  120.  
  121. // Screen Rotation
  122. https://gist.github.com/rubo77/daa262e0229f6e398766/download#
  123. nano /usr/local/bin/rotate-screen.sh
  124.  
  125. alt + f5 /usr/local/bin/rotate-screen.sh
  126. shift + alt + f5 /usr/local/bin/rotate-screen.sh -n
  127.  
  128. #!/bin/bash
  129. # This script rotates the screen and touchscreen input 90 degrees each time it is called,
  130. # also disables the touchpad, and enables the virtual keyboard accordingly
  131.  
  132. # by Ruben Barkow: https://gist.github.com/rubo77/daa262e0229f6e398766
  133.  
  134. #### configuration
  135. # find your Touchscreen and Touchpad device with `xinput`
  136. TouchscreenDevice='ELAN Touchscreen'
  137. TouchpadDevice='SynPS/2 Synaptics TouchPad'
  138.  
  139. if [ "$1" = "--help"  ] || [ "$1" = "-h"  ] ; then
  140. echo 'Usage: rotate-screen.sh [OPTION]'
  141. echo
  142. echo 'This script rotates the screen and touchscreen input 90 degrees each time it is called,'
  143. echo 'also disables the touchpad, and enables the virtual keyboard accordingly'
  144. echo
  145. echo Usage:
  146. echo ' -h --help display this help'
  147. echo ' -j (just horizontal) rotates the screen and touchscreen input only 180 degrees'
  148. echo ' -n always rotates the screen back to normal'
  149. exit 0
  150. fi
  151.  
  152. touchpadEnabled=$(xinput --list-props "$TouchpadDevice" | awk '/Device Enabled/{print $NF}')
  153. screenMatrix=$(xinput --list-props "$TouchscreenDevice" | awk '/Coordinate Transformation Matrix/{print $5$6$7$8$9$10$11$12$NF}')
  154.  
  155. # Matrix for rotation
  156. # ⎡ 1 0 0 ⎤
  157. # ⎜ 0 1 0 ⎥
  158. # ⎣ 0 0 1 ⎦
  159. normal='1 0 0 0 1 0 0 0 1'
  160. normal_float='1.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,1.000000'
  161.  
  162. #⎡ -1  0 1 ⎤
  163. #⎜  0 -1 1 ⎥
  164. #⎣  0  0 1 ⎦
  165. inverted='-1 0 1 0 -1 1 0 0 1'
  166. inverted_float='-1.000000,0.000000,1.000000,0.000000,-1.000000,1.000000,0.000000,0.000000,1.000000'
  167.  
  168. # 90° to the left
  169. # ⎡ 0 -1 1 ⎤
  170. # ⎜ 1  0 0 ⎥
  171. # ⎣ 0  0 1 ⎦
  172. left='0 -1 1 1 0 0 0 0 1'
  173. left_float='0.000000,-1.000000,1.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000'
  174.  
  175. # 90° to the right
  176. #⎡  0 1 0 ⎤
  177. #⎜ -1 0 1 ⎥
  178. #⎣  0 0 1 ⎦
  179. right='0 1 0 -1 0 1 0 0 1'
  180.  
  181. if [ $screenMatrix == $normal_float ] && [ "$1" != "-n" ]
  182. then
  183.   echo "Upside down"
  184.   xrandr -o inverted
  185.   xinput set-prop "$TouchscreenDevice" 'Coordinate Transformation Matrix' $inverted
  186.   xinput disable "$TouchpadDevice"
  187.   # Remove hashtag below if you want pop-up the virtual keyboard  
  188.   #onboard &
  189. elif [ $screenMatrix == $inverted_float ] && [ "$1" != "-j" ] && [ "$1" != "-n" ]
  190. then
  191.   echo "90° to the left"
  192.   xrandr -o left
  193.   xinput set-prop "$TouchscreenDevice" 'Coordinate Transformation Matrix' $left
  194.   xinput disable "$TouchpadDevice"
  195.   #killall onboard
  196. elif [ $screenMatrix == $left_float ] && [ "$1" != "-j" ] && [ "$1" != "-n" ]
  197. then
  198.   echo "90° to the right"
  199.   xrandr -o right
  200.   xinput set-prop "$TouchscreenDevice" 'Coordinate Transformation Matrix' $right
  201.   xinput disable "$TouchpadDevice"
  202.   #killall onboard
  203. else
  204.   echo "Back to normal"
  205.   xrandr -o normal
  206.   xinput set-prop "$TouchscreenDevice" 'Coordinate Transformation Matrix' $normal
  207.   xinput enable "$TouchpadDevice"
  208.   #killall onboard
  209. fi
  210.  
  211.  
  212.  
  213. // Auto rotation (1)
  214. nano /usr/local/bin/rotate-screen.sh
  215.  
  216. #!/bin/bash
  217. # This script rotates the screen and touchscreen input 180 degrees, disables the touchpad, and enables the virtual keyboard
  218. # And rotates screen back if the touchpad was disabled
  219.  
  220. isEnabled=$(xinput --list-props 'SynPS/2 Synaptics TouchPad' | awk '/Device Enabled/{print $NF}')
  221.  
  222. if [ $isEnabled == 1 ]
  223. then
  224.     echo "Screen is turned upside down"
  225.     xrandr -o inverted
  226.     xinput set-prop 'ELAN Touchscreen' 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1
  227.     xinput disable 'SynPS/2 Synaptics TouchPad'
  228.  
  229.     # Remove hashtag below if you want pop-up the virtual keyboard  
  230.     onboard &
  231.  
  232.     # Disable Keyboard
  233.     # xinput list - AT Translated Set 2 keyboard
  234.     # xinput float <id#>       
  235.     # xinput float 11
  236.     xinput disable 'AT Translated Set 2 keyboard'
  237. else
  238.     echo "Screen is turned back to normal"
  239.     xrandr -o normal
  240.     xinput set-prop 'ELAN Touchscreen' 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1
  241.     xinput enable 'SynPS/2 Synaptics TouchPad'
  242.  
  243.     killall onboard
  244.  
  245.     # re-enable keyboard
  246.     # xinput reattach <id#> <master/slave#>
  247.     # xinput reattach 11 3
  248.     xinput enable 'AT Translated Set 2 keyboard'
  249. fi
  250.  
  251. sudo chmod +x /usr/local/bin/rotate-screen.sh
  252.  
  253. sudo nano /usr/share/applications/rotate-screen.desktop
  254.      
  255. [Desktop Entry]
  256. Type=Application
  257. Terminal=false
  258. Icon=/usr/share/icons/Humanity/actions/24/window_fullscreen.svg
  259. Name=Rotate Screen
  260. Exec=/usr/local/bin/rotate-screen.sh
  261. Categories=Utility;
Advertisement
Add Comment
Please, Sign In to add comment