0f4d22509165887a88f7363c1a22a04d8421e54c
[ikiwiki.git] / docs / newhandbook / ConfigChromebook / index.mdwn
1 ## Chromebook Config
2
3 DragonFly currently supports the Acer C720 and C720p Intel-haswell chromebook.  You must follow the linux directions on how to unlock the chromebook so non-chrome OSs can be installed.  Generally speaking, the linux directions get you to a point where you can boot any kernel via the built-in SeaBIOS.  Note that you can always restore your chromebook back to using chrome by following Google's directions on recovering a chromebook.
4
5 On the Acer C720 you need to load specific drivers to gain support for the touchpad and touchscreen.  In "/boot/loader.conf" add:
6
7     ig4_load="YES"
8     cyapa_load="YES"
9     atmel_mxt_load="YES"
10     if_ath_load="YES"
11
12 The atmel module is only needed for the touchscreen model.
13
14 DragonFly supports accelerated X on haswell cpus via the "intel" driver.  You no longer have to recompile the X server, the dports binaries are completely up-to-date and support it properly.
15
16 The "/etc/X11/xorg.conf" configuration file should consist of the following:
17
18     Section "ServerLayout"
19             Identifier     "X.org Configured"
20             Screen      1  "Screen0" 0 0
21             InputDevice    "Mouse0" "CorePointer"
22             InputDevice    "Mouse1" "SendCoreEvents"
23             InputDevice    "TouchScreen0" "SendCoreEvents"
24             InputDevice    "Keyboard0" "CoreKeyboard"
25     EndSection
26
27     # This may be needed to prevent X from ignoring keyboard
28     # and mouse devices in xorg.conf.
29     #
30     Section "ServerFlags"
31             Option "AutoAddDevices" "False"
32     EndSection
33
34     Section "Files"
35             ModulePath   "/usr/local/lib/xorg/modules"
36             FontPath     "/usr/local/lib/X11/fonts/misc/"
37             FontPath     "/usr/local/lib/X11/fonts/TTF/"
38             FontPath     "/usr/local/lib/X11/fonts/OTF/"
39             FontPath     "/usr/local/lib/X11/fonts/Type1/"
40             FontPath     "/usr/local/lib/X11/fonts/100dpi/"
41             FontPath     "/usr/local/lib/X11/fonts/75dpi/"
42     EndSection
43
44     Section "Module"
45             Load  "dbe"
46             Load  "dri"
47             Load  "dri2"
48             Load  "extmod"
49             Load  "record"
50             Load  "glx"
51     EndSection
52
53     Section "InputDevice"
54             Identifier  "Keyboard0"
55             Driver      "kbd"
56     EndSection
57
58     Section "InputDevice"
59             Identifier  "Mouse0"
60             Driver      "mouse"
61             Option          "Protocol" "imps/2"
62             Option          "Device" "/dev/cyapa0-67"
63     EndSection
64
65     Section "InputDevice"
66             Identifier  "Mouse1"
67             Driver      "mouse"
68             Option          "Protocol" "auto"
69             Option          "Device" "/dev/ums0"
70             Option          "ZAxisMapping" "4 5 6 7"
71     EndSection
72
73     Section "InputDevice"
74             Identifier  "TouchScreen0"
75             Driver      "elographics"
76             Option          "Device" "/dev/atmel1-4a"
77     #   Option      "ZAxisMapping" "4 5 6 7"
78     EndSection
79
80     Section "Monitor"
81             Identifier   "Monitor0"
82             VendorName   "Monitor Vendor"
83             ModelName    "Monitor Model"
84     EndSection
85
86     Section "Device"
87             #Option     "NoAccel" "true"                # [<bool>]
88             #Option     "AccelMethod"           # <str>
89             #Option     "Backlight"             # <str>
90             #Option     "DRI"                   # <str>
91             Identifier  "Card0"
92             Driver      "intel"
93             #Option     "ReprobeOutputs" "true"
94             #BusID      "PCI:0:2:0"
95     EndSection
96
97     Section "Screen"
98             Identifier "Screen0"
99             Device     "Card0"
100             Monitor    "Monitor0"
101             SubSection "Display"
102                     Depth     1
103             EndSubSection
104             SubSection "Display"
105                     Depth     4
106             EndSubSection
107             SubSection "Display"
108                     Depth     8
109             EndSubSection
110             SubSection "Display"
111                     Depth     15
112             EndSubSection
113             SubSection "Display"
114                     Depth     16
115             EndSubSection
116             SubSection "Display"
117                     Depth     24
118             EndSubSection
119     EndSection
120
121 For the touchscreen to work, you need to install the "xf86-input-elographics" driver:
122
123     pkg install xf86-input-elographics
124
125 We suggest [starting X via xdm](http://www.dragonflybsd.org/docs/newhandbook/X/#index4h3) which needs a package in addition to xorg:
126
127     pkg install xdm
128
129 For WIFI support you will want this in your "/etc/rc.conf"
130
131     wlans_ath0="wlan0"
132     ifconfig_wlan0="DHCP WPA"
133
134 And your "/etc/wpa_supplicant.conf" file should contain entries for all the wifi basestations you can connect to.  Most typically an entry looks like this:
135
136     network={
137         ssid="blahblah"
138         psk="passwordhere"
139     }
140
141 ### Volume and backlight adjustment keys
142 In order to use these keys make two scripts:
143
144     #!/bin/csh
145     #
146     # mute script
147     
148     set curvol = "`mixer -f /dev/mixer1 -s vol`"
149     
150     if ( -f ~/.savemute ) then
151             set lastvol = "`cat ~/.savemute`"
152     else
153             set lastvol = ""
154     endif
155     
156     if ( "$curvol" == "vol 0:0" ) then
157             if ( "$lastvol" != "" ) then
158                     eval mixer -f /dev/mixer1 $lastvol
159             endif
160     else
161             if ( "$lastvol" != "$curvol" ) then
162                     echo "$curvol" > ~/.savemute
163             endif
164             mixer -f /dev/mixer1 vol 0
165     endif
166
167     #!/bin/csh
168     #
169     # backlight script
170     
171     set level = `sysctl -n hw.backlight_level`
172     @ level = $level + $argv
173     sysctl hw.backlight_level=${level}
174
175 add next lines to `~/.xbindkeysrc`:
176
177     # Volume
178     #
179     "/path/to/scripts/mute"
180       F8
181     
182     "mixer -f /dev/mixer1 vol -5"
183       F9
184     
185     "mixer -f /dev/mixer1 vol +5"
186       F10
187     
188     # Screen
189     #
190     "/path/to/scripts/backlight -20"
191       F6
192     
193     "/path/to/scripts/backlight 20"
194       F7
195
196 You must call xbindkeys somewhere in your `.xinitrc`.
197
198 *Hint:* You can set default blacklight level by placing next line in `.xinitrc`:
199
200     sysctl hw.backlight_level=370
201
202 ### Home, End, Delete, ...
203
204 With Alt as modifier you can get:
205
206 Insert    = Alt + \
207
208 Delete    = Alt + BackSpace
209
210 Home      = Alt + Left
211
212 End       = Alt + Right
213
214 PageUp    = Alt + Up
215
216 PageDown  = Alt + Down
217
218 Create dirs for keyboard configuration
219
220     mkdir -p ${HOME}/.config/xkb/types ${HOME}/.config/xkb/symbols
221
222 Create modifiers' config file `${HOME}/.config/xkb/types/c720` which contains
223
224     xkb_types "c720" {
225         virtual_modifiers Alt;
226         type "ARROW" {
227             modifiers    = Shift+Alt;
228             map[Shift]  = Level2;
229             map[Alt]    = Level3;
230             map[Alt+Shift]    = Level3;
231             level_name[Level1] = "Base";
232             level_name[Level2] = "Caps";
233             level_name[Level3] = "Alt";
234         };
235     };
236
237 Create symbols' config file `${HOME}/.config/xkb/symbols/c720` which contains
238
239     xkb_symbols "c720" {
240         key <BKSL> {
241             type="ARROW",
242             repeat=yes,
243             symbol[Group1] = [backslash, bar, Insert],
244             symbol[Group2] = [backslash, slash, Insert],
245             actions[Group1] = [
246                 NoAction(),
247                 NoAction(),
248                 RedirectKey(key=<INS>, clearmods=Alt)
249             ],
250             actions[Group2] = [
251                 NoAction(),
252                 NoAction(),
253                 RedirectKey(key=<INS>, clearmods=Alt)
254             ]
255         };
256         key <BKSP> {
257             type="ARROW",
258             repeat=yes,
259             [BackSpace, BackSpace, Delete],
260             actions[Group1] = [
261                 NoAction(),
262                 NoAction(),
263                 RedirectKey(key=<DELE>, clearmods=Alt)
264             ]
265         };
266         key <LEFT> {
267             type="ARROW",
268             [Left, Left, Home],
269             actions[Group1] = [
270                 NoAction(),
271                 NoAction(),
272                 RedirectKey(key=<HOME>, clearmods=Alt)
273             ]
274         };
275         key <RGHT> {
276             type="ARROW",
277             repeat=yes,
278             [Right, Right, End],
279             actions[Group1] = [
280                 NoAction(),
281                 NoAction(),
282                 RedirectKey(key=<END>, clearmods=Alt)
283             ]
284         };
285         key <UP> {
286             type="ARROW",
287             repeat=yes,
288             [Up, Up, Prior],
289             actions[Group1] = [
290                 NoAction(),
291                 NoAction(),
292                 RedirectKey(key=<PGUP>, clearmods=Alt)
293             ]
294         };
295         key <DOWN> {
296             type="ARROW",
297             [Down, Down, Next],
298             actions[Group1] = [
299                 NoAction(),
300                 NoAction(),
301                 RedirectKey(key=<PGDN>, clearmods=Alt)
302             ]
303         };
304     };
305
306 Add next line to `.xinitrc` (or in some autoload/autostart)
307
308     setxkbmap -layout "us+c720" -types "complete+c720" -print|xkbcomp -I"$HOME/.config/xkb" - "${DISPLAY%%.*}"
309