2015年9月11日金曜日

[FreeBSD] Lenovo ThinkPad T410(update 2015/09/16 suspend/resume)

I use Lenovo ThinkPad T410 with FreeBSD-11/amd64.

Specification of Lenovo T410
Core i5(M 520  @ 2.40GHz)
8GB Memory
160GB HDD
NVIDIA GT218M [NVS 3100M] with WXGA+(1440×900)

Change log
2015/09/16: about suspend resume on X Window(nvidia Linux driver)

1. boot

FreeBSD-11-current/amd64r287499[OK]

2. suspend resume[OK]

/etc/sysctl.conf
hw.acpi.lid_switch_state=S3
/etc/rc.conf
powerd_enable="YES"
apm_enable="YES"
apmd_enable="YES"

But When start X server, after resume Screen is blank. So I currently manually switch to console[CTRL]+[ALT]+[F1] and back to X window[ALT]+[F9](2015/09/16)
With below changes(/etc/rc.suspend and /etc/rc.resume), screen blank issue was solved(2015/09/16). But after resume, LCD brightness is changed to max level.
So I need to change brightness under console([CTRL]+[ALT]+[F1}, [Fn]+[End], [ALT]+[F9])
Added Option "RegistryDwords" like below in xorg.conf, I can control brightness on X Window(2015/09/16)

--- /usr/src/etc/rc.suspend     2015-09-04 07:17:56.262486000 +0900
+++ /etc/rc.suspend     2015-09-15 21:07:03.086415000 +0900
@@ -51,6 +51,8 @@
 # If a device driver has problems suspending, try unloading it before
 # suspend and reloading it on resume.  Example:
 # kldunload usb
+/bin/sleep 1
+/usr/sbin/vidcontrol -s 1 < /dev/console
 
 /usr/bin/logger -t $subsystem suspend at `/bin/date +'%Y%m%d %H:%M:%S'`
 /bin/sync && /bin/sync && /bin/sync
--- /usr/src/etc/rc.resume      2015-09-04 07:17:56.061764000 +0900
+++ /etc/rc.resume      2015-09-15 21:07:22.665667000 +0900
@@ -55,4 +55,7 @@
 /usr/bin/logger -t $subsystem resumed at `/bin/date +'%Y%m%d %H:%M:%S'`
 /bin/sync && /bin/sync && /bin/sync
 
+sleep 1
+/usr/sbin/vidcontrol -s 9 < /dev/console
+
 exit 0
Section "Device"
        Identifier  "Card0"
        Driver      "nvidia"
        BusID       "PCI:1:0:0"
        Option "RegistryDwords" "EnableBrightnessControl=1"
EndSection


3. internel Wi-Fi[NG]

below is my log but NG.
RTL8191SEvB Wireless LAN Controller http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=21&PFid=48&Level=5&Conn=4&ProdID=226&DownTypeID=3&GetDown=false&Downloads=true Windows driver auto installation program (support WinXP/Vista)
http://rtl8191-ndis-freebsd-amd64.pages.psl1ght.ru/
https://translate.google.com/translate?sl=ru&tl=en&js=y&prev=_t&hl=en&ie=UTF-8&u=http%3A%2F%2Frtl8191-ndis-freebsd-amd64.pages.psl1ght.ru%2F&edit-text
 
# ndisgen RTL8191_8192_SE_WindowsDriver_1094.5.0117.2012.F0049_13.P0406_ISS_1.00.0180.L/91_92_SE_Driver/WinX64/nt8192se.inf RTL8191_8192_SE_WindowsDriver_1094.5.0117.2012.F0049_13.P0406_ISS_1.00.0180.L/91_92_SE_Driver/WinX64/rtl8192se.sys

# kldload ./rtl8192se_sys.ko
no match for NdisMCloseLog
no match for NdisMCreateLog
no match for NdisMWriteLogData
no match for ExCreateCallback
no match for ExNotifyCallback
no match for IoWMIQueryAllData
no match for IoWMIOpenBlock
ndis0: <11b adapter="" express="" g="" ii="" lan="" mini-pci="" n="" wireless=""> port 0x3000-0x30ff m\
em 0xf2000000-0xf2003fff irq 17 at device 0.0 on pci3
device_attach: ndis0 attach returned 12
pci0:3:0:0: Device leaked IRQ resources
pci0:3:0:0: Device leaked memory resources
pci0:3:0:0: Device leaked I/O resources
 

4. USB Wi-Fi (run0) [OK]

/etc/rc.conf
wlans_run0="wlan0"
ifconfig_wlan0="WPA DHCP"
And you need to setup /etc/wpa_supplicant.conf.
See wpa_supplicant related document.

5. Internetl 1000base-TX LAN(em0) [OK]


6. Sound [OK]

on /etc/sysctl.conf
hw.snd.default_unit=5 # 5=internal speaker, 4=3.5mm jack

7. X Window server[OK]

I use x11/nvidia-driver-340 and you need to enable linux emulator.
linux_enable="YES"

8. my /boot/loader.conf

cpufreq_load="YES"
acpi_load="YES"
acpi_ibm_load="YES"
#
drm2_load="YES"
#
# Boot-time kernel tuning(for chromium)
kern.ipc.shmseg=1024
kern.ipc.shmmni=1024
kern.maxproc=10000
#
# bridge module(for VirtualBox)
if_bridge_load="YES"             # if_bridge(4) devices
if_tap_load="YES"                # Ethernet tunnel software network interface
vboxdrv_load="YES"
#
# for Video Driver
nvidia_load="YES"
#
if_ural_load="YES"
if_run_load="YES"               # Ralink Technology USB 802.11a/g/n wireless
runfw_load="YES"

9. my /etc/rc.conf(related to ThinkPad)

# power management
powerd_enable="YES"
apm_enable="YES"
apmd_enable="YES"
# X Window
linux_enable="YES"      # Linux binary compatibility loaded at startup (or NO).
dbus_enable="YES"
hald_enable="YES"
# network
wlans_run0="wlan0"
ifconfig_wlan0="WPA DHCP"
##############################################
#
# VirtualBox
#
# http://wiki.zs64.net/VirtualBox_on_FreeBSD_cheat_sheet
#
cloned_interfaces="bridge0 tap0 tap1 tap2"
ifconfig_bridge0="ether 02:00:00:00:00:01 addm tap0 addm tap1 addm tap2 addm net0 wlan0"
devfs_system_ruleset="system"
#
vboxnet_enable="YES"

10. my kernel configuration

include GENERIC

ident           LAVENDER
#
nooptions         DDB                     # Support DDB.
nooptions         GDB                     # Support remote GDB.
nooptions         DEADLKRES               # Enable the deadlock resolver
nooptions       INVARIANTS              # Enable calls of extra sanity checking
nooptions       INVARIANT_SUPPORT       # Extra sanity checks of internal structures, required by INVARIANTS
nooptions       WITNESS                 # Enable checks to detect deadlocks and cycles
nooptions       WITNESS_SKIPSPIN        # Don't run witness on spinlocks for speed

nooptions         MALLOC_DEBUG_MAXZONES # Separate malloc(9) zones

11. my /etc/sysctl.conf

hw.acpi.lid_switch_state=S3
kern.ipc.shm_allow_removed=1
#
# Disable PC Speaker
kern.vt.enable_bell=0
net.link.tap.user_open=3
net.link.tap.up_on_open=3
hw.snd.default_unit=5 # 5=internal speaker, 4=3.5mm jack