# HOW TO: Lenovo P400 touchscreen FreeBSD



## sk8harddiefast (Feb 13, 2015)

*HAVE IN MIND: FreeBSD is a SERVER OS.*
*May work on some laptops. May not. Is not designed to low power management, or work with everything a laptop has. Need a lot of tweaking, a lot of patience and a lot of tests to do it workable. Some things will work but not with the obvious way.*
*This is not Linux and to put it into a laptop with a list of devices and battery, make it more difficult because except the fast battery drain, you should do it work to economy / performance mode when you unplug / plug the charger.*
*This tutorial is specific for Lenovo P400 touchpad and may not work everything on other Laptops. Even on other Lenovo models.*


Trying to make my laptop to work with FreeBSD, I am going to start a tutorial.
I will post every progress I make and everything works/will work.

It is 10.1-RELEASE with the Gnome 3 desktop environment.

*SSD*

Installation on SSD: https://forums.freebsd.org/threads/is-this-the-right-setup-for-ssd.50358/

Also we can install the system normal on UFS and enable trim support  from single user mode with this command:


```
tunefs -t /dev/adaXpX
```

(ada0p2 on my ssd)

*Power Management* (The big problem)

Add this on /boot/loader.conf


```
hint.p4tcc.0.disabled="1"
hint.acpi_throttle.0.disabled="1"
drm.i915.enable_rc6=7
```

and this on /etc/rc.conf


```
performance_cx_lowest="Cmax"
economy_cx_lowest="Cmax"
powerd_enable="YES"
powerd_flags="-a hadp -b adaptive -i 50 -r 75"
```

*Sound*

Add this line to /boot/loader.conf


```
snd_ich_load="YES"
snd_hda_load="YES"
```

For some reason need both of them to work properly

*Graphics.* Works perfect with right resolution

Build this: x11-drivers/xf86-video-intel and multimedia/libva-intel-driver

No need to create xorg.conf file

*Mouse and Keyboard*

Add this on /etc/rc.conf


```
hald_enable="YES"
dbus_enable="YES"
```

and build / rebuild from ports:

http://www.freshports.org/x11-drivers/xf86-input-mouse
http://www.freshports.org/x11-drivers/xf86-input-keyboard

*Microphone*

Works by default on 10.1-RELEASE

*Headphones*

Works by default on 10.1-RELEASE

*Ethernet*

Works by default on 10.1-RELEASE

This is my configuration on /etc/rc.conf


```
ifconfig_re0="inet 192.168.1.20 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
```

*Brightness*

It was big surprise for me.

Add this lines into /boot/loader.conf


```
acpi_ibm_load="YES"
acpi_video_load="YES"
```

And this lines to /etc/sysctl.conf


```
hw.acpi.video.lcd0.brightness: 100
hw.acpi.video.lcd0.fullpower: 100
hw.acpi.video.lcd0.economy: 20
```

*Logout Problem*

You must build your kernel with the new console driver. Newcons.
See here: https://wiki.freebsd.org/Newcons

and add this line in /boot/loader.conf


```
hw.vga.textmode=1
```

*Camera*

My second big surprise. On gnome3 , cheese works!

Install from ports

http://www.freshports.org/multimedia/webcamd/
http://www.freshports.org/multimedia/cuse4bsd-kmod/

On /etc/rc.conf add


```
webcamd_enable="YES"
```

On /boot/loader.conf add


```
cuse4bsd_load="YES"
```

On /etc/devfs.conf add


```
perm video0 0666
```

The problem is that if you take a screenshot, picture is not saved on /home/.gnome2/cheese/media.
Also camera stops working so you must restart cheese application
I will search about this later.

*FN KEYS*


Brightness works. See Above how.
For Volume. Up and down works by default.
PrintScreen too.

To Make mute works too:

Go to gnome3-settings -> Keyboard -> Shortcuts -> Sound and Media and give a key combination for Volume Mute.

Something similar exists on other Desktop Environments too

*Remove Beeps*

See here: https://forums.freebsd.org/threads/cannot-make-system-bell-stop.50410/#post-282351

*Wifi*

Worked updating to 11-CURRENT

*Suspend - Resume*

Gnome 3 suspend is not working.

But

`sudo apm -z`

Easy and fast. No configs, no problems!

*Temperatures*

Add this line to /boot/loader.conf


```
coretemp_load="YES"
```

You can see the temperatures by this command:

`sysctl -a | grep temperature`

Output


```
hw.acpi.thermal.tz0.temperature: 41.0C
dev.cpu.0.temperature: 40.0C
dev.cpu.1.temperature: 40.0C
dev.cpu.2.temperature: 44.0C
dev.cpu.3.temperature: 44.0C
dev.cpu.4.temperature: 43.0C
dev.cpu.5.temperature: 43.0C
dev.cpu.6.temperature: 47.0C
dev.cpu.7.temperature: 47.0C
```

*DVD-RW Drive*

Add this lines on /boot/loader.conf


```
atapicam_load="YES"
cd9660_load="YES"
```

And this lines into /etc/devfs.conf


```
link cd0 cdrom
link cd0 dvd
perm cd* 0666
perm xpt* 0666
perm pass* 0666
```

*USB2 - USB3*

Works by default on FreeBSD 10.1

SD card

Not supported


*
bluetooth
touchscreen
synaptics touchpad
Bluetooth
hdmi*
are on the way.

Pffff. A lot of devices


----------



## wblock@ (Feb 13, 2015)

Please only use `Xorg -configure` when necessary.  It produces poor configuration files and is usually not necessary.


----------



## sk8harddiefast (Feb 13, 2015)

I test it. You have right. xorg.conf file is not needed.


----------



## abishai (Feb 20, 2015)

Isn't you need fonts section to proper list all of your fonts in xorg.conf ?


----------

