Realtek 5287 PCIe controller for memory card reader

Well, I finally got the memory card reader in my new Clevo W230SS laptop working, but, as is often the case with Linux, I’m not sure precisely which kernel configuration parameter or parameters are responsible.

By googling the device number given in the output from the lspci command, I deduced that the memory card controller is the following PCIe device:

04:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. Device 5287 (rev 01)

The vendor ID for Realtek is 10ec and the device ID is 5287. By the way, PCIDatabase.com is a good resource if you need to research PCI devices.

I then rebuilt the kernel several times, changing various configuration parameters each time. One or more of them finally did the trick, but probably several are irrelevant. Anyway, below I summarise the current configuration.

$ uname -a
Linux clevow230ss 3.18.11-gentoo #20 SMP Tue Apr 28 05:48:42 BST 2015 x86_64 Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz GenuineIntel GNU/Linux

$ cat /usr/src/linux/.config | grep -i mmc
CONFIG_PCI_MMCONFIG=y
# Supported MMC/SDIO adapters
CONFIG_MMC=y
# CONFIG_MMC_DEBUG is not set
# CONFIG_MMC_CLKGATE is not set
# MMC/SD/SDIO Card Drivers
CONFIG_MMC_BLOCK=m
CONFIG_MMC_BLOCK_MINORS=8
CONFIG_MMC_BLOCK_BOUNCE=y
# CONFIG_MMC_TEST is not set
# MMC/SD/SDIO Host Controller Drivers
CONFIG_MMC_SDHCI=m
CONFIG_MMC_SDHCI_PCI=m
CONFIG_MMC_RICOH_MMC=y
CONFIG_MMC_SDHCI_ACPI=m
CONFIG_MMC_SDHCI_PLTFM=m
CONFIG_MMC_WBSD=m
CONFIG_MMC_TIFM_SD=m
CONFIG_MMC_CB710=m
CONFIG_MMC_VIA_SDMMC=m
CONFIG_MMC_VUB300=m
CONFIG_MMC_USHC=m
CONFIG_MMC_USDHI6ROL0=m
CONFIG_MMC_REALTEK_PCI=m

As can be seen more clearly via menuconfig (see below), several of the Host Controller Drivers listed above are irrelevant because they are for other manufacturers’ controllers, not Realtek, but I have left them configured for the time being and will tidy up the configuration later.

--- MMC/SD/SDIO card support
[ ]   MMC debugging
[ ]   MMC host clock gating
*** MMC/SD/SDIO Card Drivers ***
<M>   MMC block device driver
(8)     Number of minors per block device
[*]     Use bounce buffer for simple hosts
< >   SDIO UART/GPS class support
< >   MMC host test driver
*** MMC/SD/SDIO Host Controller Drivers ***
<M>   Secure Digital Host Controller Interface support
<M>   SDHCI support on PCI bus
[*]     Ricoh MMC Controller Disabler
<M>   SDHCI support for ACPI enumerated SDHCI controllers
<M>   SDHCI platform and OF driver helper
<M>   Winbond W83L51xD SD/MMC Card Interface support
<M>   TI Flash Media MMC/SD Interface support
<M>   ENE CB710 MMC/SD Interface support
<M>   VIA SD/MMC Card Reader Driver
<M>   VUB300 USB to SDIO/SD/MMC Host Controller support
<M>   USB SD Host Controller (USHC) support
<M>   Renesas USDHI6ROL0 SD/SDIO Host Controller support
<M>   Realtek PCI-E SD/MMC Card Interface Driver

The card reader does not support the Sony Memory Stick format, so the configuration parameters mentioning ‘MEMSTICK‘ that I selected may be irrelevant:

$ cat /usr/src/linux/.config | grep -i memstick
CONFIG_MEMSTICK=m
# CONFIG_MEMSTICK_DEBUG is not set
# CONFIG_MEMSTICK_UNSAFE_RESUME is not set
# CONFIG_MEMSTICK_TIFM_MS is not set
# CONFIG_MEMSTICK_JMICRON_38X is not set
# CONFIG_MEMSTICK_R592 is not set
CONFIG_MEMSTICK_REALTEK_PCI=m

I’m almost certain that CONFIG_MMC_REALTEK_PCI needs to be selected, though:

$ cat /usr/src/linux/.config | grep -i realtek
CONFIG_NET_VENDOR_REALTEK=y
# CONFIG_SND_HDA_CODEC_REALTEK is not set
# CONFIG_USB_STORAGE_REALTEK is not set
CONFIG_MMC_REALTEK_PCI=m
CONFIG_MEMSTICK_REALTEK_PCI=m

I enabled some of the configuration parameters that mention ‘HOTPLUG‘ because I came across an article regarding the Realtek RTS5209 PCIe card reader that enabled them:

$ cat /usr/src/linux/.config | grep -i hotplug
# CONFIG_MEMORY_HOTPLUG is not set
CONFIG_HOTPLUG_CPU=y
# CONFIG_BOOTPARAM_HOTPLUG_CPU0 is not set
# CONFIG_DEBUG_HOTPLUG_CPU0 is not set
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
CONFIG_ACPI_HOTPLUG_CPU=y
CONFIG_HOTPLUG_PCI_PCIE=y
CONFIG_HOTPLUG_PCI=y
CONFIG_HOTPLUG_PCI_ACPI=y
# CONFIG_HOTPLUG_PCI_ACPI_IBM is not set
# CONFIG_HOTPLUG_PCI_CPCI is not set
# CONFIG_HOTPLUG_PCI_SHPC is not set
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"

I have no idea if the ‘Secure Digital Host Controller Interface’ is needed for the Realtek 5287, but I read some blogs and posts claiming it is needed for memory cards, so I selected it in the kernel configuration and included the module in /etc/conf.d/modules:

$ cat /usr/src/linux/.config | grep -i sdhci
CONFIG_MMC_SDHCI=m
CONFIG_MMC_SDHCI_PCI=m
CONFIG_MMC_SDHCI_ACPI=m
CONFIG_MMC_SDHCI_PLTFM=m

I built the rts5208 module but, as that module is not loaded in my case (see the output of lsmod further on), I assume it is actually irrelevant:

Device Drivers
    ---> Staging Drivers
       ---> Realtek PCI-E Card Reader RTS5208/5288 Support

$ cat /usr/src/linux/.config | grep -i rts5208
CONFIG_RTS5208=m

Below is the current output of the lsmod command, showing which modules are actually loaded currently:

$ lsmod
Module                  Size  Used by
nf_conntrack_ipv6       6211  4 
nf_defrag_ipv6         22518  1 nf_conntrack_ipv6
nf_conntrack_ipv4      11296  8 
nf_defrag_ipv4          1283  1 nf_conntrack_ipv4
xt_conntrack            3081  12 
nf_conntrack_netbios_ns     1021  0 
nf_conntrack_broadcast     1133  1 nf_conntrack_netbios_ns
nf_nat_ftp              1676  0 
nf_nat                 10540  1 nf_nat_ftp
nf_conntrack_ftp        6751  1 nf_nat_ftp
nf_conntrack           59239  8 nf_nat_ftp,nf_conntrack_netbios_ns,nf_nat,xt_conntrack,nf_conntrack_broadcast,nf_conntrack_ftp,nf_conntrack_ipv4,nf_conntrack_ipv6
sdhci_pci              10641  0 
sdhci                  22004  1 sdhci_pci
cifs                  438492  0 
mmc_block              25911  2 
hidp                   14125  0 
rfcomm                 32181  12 
bnep                   10116  2 
fuse                   76386  4 
nvidia               8385213  33 
ecb                     1921  1 
iwlmvm                143855  0 
btusb                  22292  0 
bluetooth             281605  33 bnep,hidp,btusb,rfcomm
uvcvideo               71061  0 
rtsx_pci_ms             5122  0 
memstick                6256  1 rtsx_pci_ms
iwlwifi                75755  1 iwlmvm
r8169                  67544  0 
mii                     3875  1 r8169
rtsx_pci_sdmmc          9905  0 
rtsx_pci               26695  2 rtsx_pci_ms,rtsx_pci_sdmmc
videobuf2_vmalloc       2800  1 uvcvideo
videobuf2_memops        1799  1 videobuf2_vmalloc
videobuf2_core         34587  1 uvcvideo
mfd_core                3193  1 rtsx_pci
x86_pkg_temp_thermal     4567  0

And, finally, below you can see which modules I have explicitly specified to be loaded so far:

$ cat /etc/conf.d/modules
modules="r8169 nvidia agpgart fuse bnep rfcomm hidp uvcvideo cifs mmc_block sdhci-pci rtsx_pci"

Anyway, the important thing is that the laptop’s card reader is now working.

A new laptop

At the beginning of this month my trusty Compal NBLB2 laptop completed five years of heavy use. The HDD was almost full (mostly with my work files) and the laptop’s size and weight were starting to become troublesome on my frequent work trips. So I decided to bite the bullet and buy a new laptop. As Compal is an OEM and I was able to specify various components when buying the NBLB2, I decided to buy an OEM laptop again this time. In the end I decided on the Clevo W230SS, which I ordered from pcspecialist. The configuration I specified is listed below:

  • 13.3″ matte full HD LED IPS widescreen (1920×1080).
  • Intel Core i7 quad-core mobile processor i7-4810MQ (2.80GHz) 6MB.
  • 16GB Kingston SODIMM DDR3 1600MHz (2 x 8GB).
  • NVIDIA GeForce GTX 860M – 2.0GB DDR5, 640 CUDA cores.
  • 750GB WD Scorpio Black WD7500BPKX, SATA 6 Gb/s, 16MB cache (7200 rpm).
  • 8x Samsung slim USB 2.0 external DVD-RW.
  • Integrated 6-in-1 memory card reader (SD/MiniSD/SDHC/SDXC/MMC/RSMMC).
  • Arctic MX-4 Extreme thermal conductivity compound.
  • Intel 2-channel High Definition Audio + mic & headphone jacks.
  • Gigabit LAN & Wireless Intel AC-7260 HMC (867Mbps, 802.11AC) + Bluetooth.
  • 3 USB 3.0 ports + 1 USB 2.0 port.
  • Backlit UK keyboard.
  • 2-button touchpad.
  • 2.0 megapixel Webcam.
  • 6-cell lithium ion battery (62.16WH).
  • Power lead & 120W AC adaptor.
  • 3-year warranty (1 year collect & return; 1 year parts; 3 years labour).
  • 1-year dead pixel guarantee inc. labour & carriage.
  • No operating system required.

The laptop has both a VGA port and an HDMI port. The VGA port is important to me because I need to connect to various models of legacy monitors and projectors in the various offices where I work.

The time from ordering the laptop to its delivery was nine days, and I was impressed with the service by pcspecialist; I received e-mails at each stage of building, testing and delivery (including the option to change the delivery date), and was informed of the name of the courier company, the time of delivery and even the name of the van driver!

My two previous laptops were configured to dual-boot Linux and Windows, but this time I decided not to bother with Windows and install only Gentoo Linux. I virtually never use Windows on the Compal anyway, opting instead to run Microsoft Office 2007 with WINE in Linux, so I decided to save some money this time. I followed the Gentoo AMD64 Handbook to install the operating system and, with one exception which I will mention further on, the Handbook is a very accurate guide.

I have the Testing branch of Gentoo (‘~amd64’) installed on the Compal, but decided to install the Stable branch of Gentoo (‘amd64’) on the Clevo. Since several of the packages I wanted to install are in the Testing branch, I would declare them in /etc/portage/package.accept_keywords/ in order to be able to install them regardless.

Below are some rough notes on what I did, in case they are of any interest to others contemplating installing Gentoo on a laptop with a similar specification. I have to say I like the Clevo W230SS very much so far, although I find the NVIDIA Optimus hardware and driver more complicated to configure than the AMD ATI GPUs on my previous two laptops, and the NVIDIA driver does not work as well with the xrandr command as does the AMD FGLRX driver for ATI GPUs.

When I pressed F2 at boot to check the configuration of the American Megatrends BIOS, I found that UEFI was turned off, and I left it that way. The HDD was apparently MBR not GPT. I was happy to use PC BIOS and MBR rather than UEFI and GPT as that meant I would not have to fiddle with new technology with which I am unfamiliar, and GPT is not necessary as the HDD capacity is less than 2 TiB.

I then booted the HDD for the first time to check if pcspecialist had left anything on it after testing, and the Windows 7 Home Premium ‘Setup is preparing your computer for first use’ screen was displayed. As I had not ordered Windows and therefore had no Microsoft key, and as I did not want Windows on the laptop in any case, I used GParted on a SystemRescueCD Live pen drive to repartition and format the HDD.

I followed the Gentoo AMD64 Handbook but used SystemRescueCd rather than a Gentoo LiveCD or LiveDVD, and therefore I did not have to perform the installation procedure from the very beginning of the Handbook. After downloading the latest SystemRescueCd ISO and installing it to a pen drive (see the instructions on the SystemRescueCd Web site), I booted SystemRescueCd from the pen drive and connected the SystemRescueCd Xfce Live environment to the Web via WiFi. I did not bother to connect an Ethernet cable to the laptop and performed the entire installation of Gentoo to the HDD under WiFi.

I did not need to use the method given in the Gentoo Handbook for creating partitions; I used GParted on SystemRescueCD instead of fdisk or parted on the command line. I was therefore able to ignore the first few pages and started following the Handbook in earnest from Activating the swap partition onwards.

The Handbook recommends creating a ‘BIOS boot partition’ as well as a ‘boot partition’. This is really only necessary for UEFI machines or if the GRUB Embedding Area on the HDD is too small (the GNU Grub Manual 2.00 says the space reserved for the GRUB Embedding Area has to be at least 31 KiB). I did not need to create a ‘BIOS boot partition’, as GParted would only let me create the first partition starting 1 MiB from the beginning of the HDD. Actually, GParted will not let you create /dev/sda1 right at the beginning of the disk; it always seems to want the partition to start 1 MiB from the beginning of the HDD, so I don’t understand why the Handbook wants you to create a ‘BIOS boot partition’ before the Boot partition in the case of MBR HDDs, as there would still be 1 MiB of empty space before the ‘BIOS boot partition’, rendering the latter a waste of space and effort. (As I understand it, the situation is different in the case of GPT because the EFI boot partition must be FAT32, so you have no choice but to create a ‘BIOS boot partition’ if you’re using a GPT HDD.) Perhaps if you are using fdisk or parted on the command line then the situation is different and those commands do allow you to put the first partition right at the beginning of the HDD. So I created the following partitions by using GParted:

/dev/sda1 /boot (Primary Partition)
/dev/sda2 swap (Primary Partition)
/dev/sda3 (Extended Partition)
/dev/sda5 / (Logical Partition)
/dev/sda6 /home (Logical Partition)
/dev/sda7 NTFS partition (Logical Partition)

I specified the ext2 file system for /boot, and ext4 for / and /home. I have used these file systems for many years on previous laptops, and they are very reliable. I decided to add an NTFS partition to store my work files separately from my home files, and in case I ever want to access the laptop using Windows from e.g. a bootable external USB drive or whatever.

When creating the logical partitions sda5, sda6 and sda7, GParted always left 1 MiB unallocated before each logical partition. And I don’t know why GParted would not create a partition named /dev/sda4.

The precise partition configuration is listed below:

# fdisk -l

Disk /dev/sda: 698.7 GiB, 750156374016 bytes, 1465149168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x291ba0e7

 
Device     Boot     Start        End    Sectors   Size Id Type
/dev/sda1            2048     264191     262144   128M 83 Linux
/dev/sda2          264192   33822719   33558528    16G 82 Linux swap / Solaris
/dev/sda3        33822720 1465147391 1431324672 682.5G  5 Extended
/dev/sda5        33824768  302260223  268435456   128G 83 Linux
/dev/sda6       302262272  839133183  536870912   256G 83 Linux
/dev/sda7       839135232 1465147391  626012160 298.5G  7 HPFS/NTFS/exFAT

# blkid
/dev/sda1: LABEL="BOOT" UUID="f6ffc085-66fe-4bbe-b080-cec355749f85" TYPE="ext2" PARTUUID="291ba0e7-01"
/dev/sda2: UUID="c49e011a-bb8b-4ade-8fda-6c11ca53d660" TYPE="swap" PARTUUID="291ba0e7-02"
/dev/sda5: LABEL="ROOT" UUID="525a90f1-8ad2-44a3-ade3-20f18a0a9595" TYPE="ext4" PARTUUID="291ba0e7-05"
/dev/sda6: LABEL="HOME" UUID="5b60d470-a92a-45b3-9607-3ff3ab483b97" TYPE="ext4" PARTUUID="291ba0e7-06"
/dev/sda7: LABEL="NTFS" UUID="16F4D9B04A85A7E5" TYPE="ntfs" PARTUUID="291ba0e7-07"

The output from the lspci command in SystemRescueCd was as follows:

# lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor DRAM Controller (rev 06)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06)
00:02.0 VGA compatible controller: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)
00:03.0 Audio device: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller (rev 06)
00:14.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI (rev 05)
00:16.0 Communication controller: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2 (rev 05)
00:1b.0 Audio device: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller (rev 05)
00:1c.0 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1 (rev d5)
00:1c.2 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #3 (rev d5)
00:1c.3 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #4 (rev d5)
00:1d.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1 (rev 05)
00:1f.0 ISA bridge: Intel Corporation HM87 Express LPC Controller (rev 05)
00:1f.2 SATA controller: Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode] (rev 05)
00:1f.3 SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller (rev 05)
01:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 860M] (rev a2)
03:00.0 Network controller: Intel Corporation Wireless 7260 (rev bb)
04:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. Device 5287 (rev 01)
04:00.1 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 12)

The output from the lsusb command in SystemRescueCd was as follows:

# lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 004: ID 5986:055c Acer, Inc <-- The Webcam!
Bus 003 Device 003: ID 8087:07dc Intel Corp.
Bus 003 Device 002: ID 0dd8:17c0 Netac Technology Co., Ltd
Bus 003 Device 005: ID 090c:3261 Silicon Motion, Inc. - Taiwan (formerly Feiya Technology Corp.)
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 8087:8000 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

The output from the lsmod command in SystemRescueCd was as follows:

# lsmod
Module                  Size  Used by
nilfs2                117674  0 
ccm                    16515  2 
arc4                   12390  2 
iwlmvm                149978  0 
mac80211              421465  1 iwlmvm
btusb                  24725  0 
iwlwifi                88602  1 iwlmvm
bluetooth             258391  2 btusb
cfg80211              320349  3 iwlwifi,mac80211,iwlmvm
x86_pkg_temp_thermal    12390  0 
6lowpan_iphc           16649  1 bluetooth
coretemp               12390  0 
iTCO_wdt               12390  0 
mei_me                 12576  0 
iTCO_vendor_support    12938  1 iTCO_wdt
crct10dif_pclmul       12479  0 
crc32_pclmul           12483  0 
crc32c_intel           16568  0 
i2c_i801               16533  0 
ghash_clmulni_intel    12523  0 
mei                    58244  1 mei_me
tpm_infineon           12437  0 
joydev                 16535  0 
tpm_tis                16533  0 
rfkill                 18094  3 cfg80211,bluetooth
serio_raw              12439  0 
tpm                    26448  2 tpm_tis,tpm_infineon
lpc_ich                20629  0 
shpchp                 29571  0 
microcode              41719  0 
raid10                 37123  0 
raid456                57671  0 
async_raid6_recov      12621  1 raid456
async_pq               12640  2 raid456,async_raid6_recov
async_xor              12573  3 async_pq,raid456,async_raid6_recov
async_memcpy           12464  2 raid456,async_raid6_recov
async_tx               12840  5 async_pq,raid456,async_xor,async_memcpy,async_raid6_recov
raid1                  28900  0 
raid0                  16515  0 
multipath              12390  0 
linear                 12390  0 
usb_storage            52365  2 
nouveau               793903  0 
i915                  586099  2 
ttm                    66567  1 nouveau
drm_kms_helper         37632  2 i915,nouveau
drm                   216971  5 ttm,i915,drm_kms_helper,nouveau
i2c_algo_bit           12633  2 i915,nouveau
i2c_core               28421  6 drm,i915,i2c_i801,drm_kms_helper,i2c_algo_bit,nouveau
rtsx_pci_sdmmc         16538  0 
mmc_core               80530  1 rtsx_pci_sdmmc
rtsx_pci_ms            12442  0 
memstick               13784  1 rtsx_pci_ms
mxm_wmi                12672  1 nouveau
r8169                  49390  0 
rtsx_pci               35470  2 rtsx_pci_ms,rtsx_pci_sdmmc
mii                    13085  1 r8169
mfd_core               12807  2 lpc_ich,rtsx_pci
wmi                    13114  2 mxm_wmi,nouveau
video                  16832  2 i915,nouveau

The output from the SystemRescueCd lsmod command told me that the nouveau driver works with this laptop, that the iwlwifi driver works too, and that the r8169 driver was the likely driver I would need for the wired Ethernet connection (I did not bother to connect an Ethernet cable whilst using SystemRescueCd).

The output from the SystemRescueCd ifconfig command told me the new names of the eth0 and wlan0 interfaces: enp4s0f1 and wlp3s0. I force udev/eudev to use interface names eth0 and wlan0 on my Compal laptop (by adding the parameter net.ifnames=0 to the kernel boot line and by using the command ‘ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules‘). However, although I dislike freedesktop.org’s so-called ‘predictable network interface names‘, I decided to stick with the new interface naming scheme on the Clevo.

As shown in the Handbook, make sure you cd into the directory /mnt/gentoo/ before downloading the Gentoo Stage 3 tarball, otherwise you will end up with the tarball in the wrong directory.

I stuck with the CPU FLAGS specified in the default make.conf file to start with, then, as soon as it was possible during the installation process, I installed app-portage/cpuinfo2cpuflags, ran it to obtain the correct CPU flags and modified /etc/portage/make.conf accordingly (I duplicated the CPU flags in USE="..." and CPU_FLAGS_X86="..." as recommended in Gentoo news item 2015-01-28-cpu_flags_x86-introduction).

I found configuring make.conf for USE flags confusing (see Configuring the USE variable). Although the KDE profile I eselected already contained quite a few of the global USE flags I thought I wanted/needed, I ended up duplicating several of them in make.conf rather than going through the output from the emerge --info command to see which USE flags are already included. I will clean up make.conf sometime in the future. The way to check which USE flags are provided by the profile is to temporarily comment out the USE variable lines in make.conf (and presumably any in /etc/portage/package.use/*) then run the emerge --info command. Anyway, here is what make.conf looked like after I had edited it:

CFLAGS="-O2 -march=native -pipe"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-O1,--as-needed"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
CHOST="x86_64-pc-linux-gnu"
MY_CPUFLAGS="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3"
CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3"

UNWANTED="-apm -branding -eds -evo -kerberos -gnome -gtk -libav -mono -nepomuk -oss -qt5 -systemd"
MY_MEDIA="alsa audiofile cdda cddb cdr dri dvb dvd dvdr dvdread jack ipod musicbrainz pulseaudio sdl v4l wmf xine"
MY_CODECS="a52 aac dts dv ffmpeg flac gsm lame matroska mp3 musepack ogg openal speex theora x264 xvid"
MY_SYSTEM="acl acpi avahi bash-completion bidi bluetooth bzip2 cjk dbus gcj gnutls icu lm_sensors lzo networkmanager nptl pam policykit udev unicode usb wifi xcb zeroconf"
MY_FILESYS="inotify"
MY_PRINT="cups foomaticdb gimp ppds scanner"
MY_XSYS="cairo dga gphoto2 gtk openexr opengl png qt4 svg tiff X xinerama"
MY_DESKTOP="gmp kde libnotify pda rdesktop semantic-desktop startup-notification"
MY_BROWSER="nsplugin"
MY_COMMS="aim icq imap jabber mbox msn rss slp yahoo"
USE="${USE} ${UNWANTED} ${MY_MEDIA} ${MY_CODECS} ${MY_SYSTEM} ${MY_FILESYS} ${MY_PRINT} ${MY_XSYS} ${MY_DESKTOP} ${MY_BROWSER} ${MY_COMMS} ${MY_CPUFLAGS}"

PORTDIR="/usr/portage"
DISTDIR="${PORTDIR}/distfiles"
PKGDIR="${PORTDIR}/packages"
# The following line is for Layman:
source /var/lib/layman/make.conf
# The following line is for my local overlay:
PORTDIR_OVERLAY="/usr/local/portage ${PORTDIR_OVERLAY}"
LINGUAS="en en_GB pt_BR es_ES"
GRUB_PLATFORMS="pc"
MAKEOPTS="-j9"

INPUT_DEVICES="evdev synaptics"
VIDEO_CARDS="intel modesetting nvidia"

GENTOO_MIRRORS="rsync://mirror.bytemark.co.uk/gentoo/ http://mirror.qubenet.net/mirror/gentoo/ rsync://rsync.mirrorservice.org/distfiles.gentoo.org/"
SYNC="rsync://rsync.uk.gentoo.org/gentoo-portage"

I don’t have the ‘source’ line and ‘SYNC’ line in my ~amd64 installation on the Compal because they are running later versions of Portage and Layman, for which the method has changed.

When following the Gentoo Handbook and merging some packages, sometimes messages about required USE flags were displayed. In some of those cases, after studying the messages carefully I repeated the merge command but included the --autounmask-write option, then used the etc-update command to apply the edits to the /etc/portage/package.use/* files, then repeated the merge command. In some cases, e.g. if only one or two USE flag changes needed, I created the new file /etc/portage/package.use/* and performed the edit manually. For example, /etc/portage/package.use/networkmanager containing:

net-misc/networkmanager nss -dhclient dhcpcd -gnutls modemmanager

I am not sure which modules to declare in /etc/conf.d/modules, since the only ones I have to declare in that file in my Compal laptop installation are VirtualBox modules and other modules are loaded automatically. Anyway, I added the r8169, nvidia and fuse modules to that file to start with. Later I added some more and it currently looks like this:

modules="r8169 nvidia fuse agpgart bnep rfcomm hidp mmc_block uvcvideo cifs"

I added ‘agpgart‘ because of what user Arthanis wrote in his post in the Gentoo Forums thread [SOLVED] Optimus and Nvidia but there is no module named agpgart in my installation, so I am not sure to what he was referring.

The modules loaded so far are listed below:

# lsmod
Module                  Size  Used by
cifs                  438492  0 
mmc_block              25911  0 
mmc_core               85695  1 mmc_block
hidp                   14125  0 
rfcomm                 32181  12 
bnep                   10116  2 
fuse                   76386  2 
nvidia               8385213  33 
ecb                     1921  1 
iwlmvm                143855  0 
r8169                  67544  0 
btusb                  22292  0 
bluetooth             281605  33 bnep,hidp,btusb,rfcomm
uvcvideo               71061  0 
videobuf2_vmalloc       2800  1 uvcvideo
videobuf2_memops        1799  1 videobuf2_vmalloc
videobuf2_core         34587  1 uvcvideo
mii                     3875  1 r8169
iwlwifi                75755  1 iwlmvm
x86_pkg_temp_thermal     4567  0

The rest of the drivers are in-kernel.

Version 216 of sys-fs/udev was installed, which predates the change in udev to stop loading firmware (see the Gentoo Forums thread udev-217 stalls booting) so I may have trouble with loading CPU microcode and WiFi firmware (and video firmware? — see further on) in future when sys-fs/udev-217 becomes stable in the Gentoo Portage tree.

I configured netifrc for enp4s0f1 only (I didn’t bother with WiFi) for DHCP, as per Gentoo Handbook section Configuring the system, as I only wanted to be sure of a network connection after rebooting until I could get NetworkManager working, at which I point I would ditch the netifrc stuff completely. As I have to travel frequently because of my work, I find NetworkManager more convenient.

Apart from configuring the kernel (I lost count of how many times I had to rebuild it), the only problem was when I installed GRUB 2 (Gentoo Handbook section Configuring the bootloader). There appears to be an error in the Gentoo Handbook; see Gentoo Forums thread grub2 install for the fix.

X Windows and NVIDIA Optimus

However, getting X Windows working was a major hassle. First I followed the Gentoo Wiki article X server to install the packages xorg-server and xorg-drivers, then I followed the Gentoo Wiki article NVIDIA Driver with Optimus Laptops to try and get the closed-source NVIDIA driver working, but X Windows could not find a screen. (I have no idea what sys-apps/qingy is or whether it is needed, but, as the Wiki article mentions it, I installed it anyway but did not add the xrandr commands to the end of the /etc/X11/Sessions/KDE-4 file, but I did add the xrandr commands to the /usr/share/config/kdm/Xsetup file.) Then I followed Gentoo user Arthanis‘ Gentoo Forums post [SOLVED] Optimus and Nvidia (changing the edid_firmware name to suit). I was confused by his reference to rcu_idle_delay, by which he meant CONFIG_RCU_FAST_NO_HZ (see Understanding RCU when Configuring the Linux Kernel). Thank goodness for his post, though, as I would never have worked it out myself. All my main laptops since 2000 have had ATI GPUs, and they were easier to set up than this NVIDIA Optimus stuff. Although the laptop has both Intel and NVIDIA graphics hardware, I think the laptop is muxless (i.e. does not have hybrid graphics/NVIDIA HybridPower), so I left CONFIG_VGASWITCHERROO=n in the kernel, but I have no idea if that is correct. This whole dual GPU/IGP switching thing confuses me.

After I followed Arthanis‘ post and rebooted, the KDM screen consisted of tiled ‘mini-screens’, with the KDM log-in window in the top left mini-screen. I solved this by adding a Virtual command in xorg.conf — see the Gentoo Forums post XOrg refusing to start after a fresh build by user qweb.ric.

Below are the current contents of xorg.conf:

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "nvidia" 0 0
    Inactive       "intel"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

#Section "Files"
#EndSection

Section "InputDevice"
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol"
    Option         "Device" "/dev/input/mice"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "nvidia"
    Driver         "nvidia"
    BusID          "PCI:1:0:0"
EndSection

Section "Device"
    Identifier     "intel"
    Driver         "modesetting"
    BusID          "PCI:0:2:0"
EndSection

Section "Screen"
    Identifier     "nvidia"
    Device         "nvidia"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "UseDisplayDevice" "none"
    SubSection     "Display"
        Depth       24
#        Modes      "nvidia-auto-select"
        Virtual     1920 1080
    EndSubSection
EndSection

Section "Screen"
    Identifier     "intel"
    Device         "intel"
    Monitor        "Monitor0"
EndSection

To get tapping to work on the touchpad I had to create the file /etc/X11/xorg.conf.d/50-synaptics.conf as usual:

Section "InputClass"
    Identifier "touchpad catchall"
    Driver "synaptics"
    MatchIsTouchpad "on"
    MatchDevicePath "/dev/input/event*"
    Option "TapButton1" "1"
    Option "TapButton2" "2"
    Option "TapButton3" "3"
    Option "VertEdgeScroll" "on"
    Option "VertTwoFingerScroll" "on"
    Option "HorizEdgeScroll" "on"
    Option "HorizTwoFingerScroll" "on"
    Option "CircularScrolling" "on"
    Option "CircScrollTrigger" "0"
    Option "EmulateTwoFingerMinZ" "40"
    Option "EmulateTwoFingerMinW" "8"
    Option "CoastingSpeed" "0"
    Option "FingerLow" "35"
    Option "FingerHigh" "40"
EndSection

Section "InputClass"
    Identifier "touchpad ignore duplicates"
    MatchIsTouchpad "on"
    MatchDevicePath "/dev/input/mouse*"
    Option "Ignore" "on"

And I also created the file /etc/X11/xorg.conf.d/30-keyboard.conf:

Section "InputClass"
    Identifier "keyboard"
    # See /usr/share/X11/xkb/rules/base.lst for Options.
    MatchIsKeyboard "yes"
    Option "XkbLayout" "gb,us,br,es"
    Option "XkbModel" "pc104"
    Option "XkbVariant" ""
    Option "XkbOptions" "grp:alt_shift_toggle"
EndSection

and the file /etc/X11/xorg.conf.d/10-evdev.conf:

Section "InputClass"
        Identifier "evdev pointer catchall"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
EndSection

Section "InputClass"
        Identifier "evdev keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
EndSection

#Section "InputClass"
#        Identifier "evdev touchpad catchall"
#        MatchIsTouchpad "on"
#        MatchDevicePath "/dev/input/event*"
#        Driver "evdev"
#EndSection

Section "InputClass"
        Identifier "evdev tablet catchall"
        MatchIsTablet "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
EndSection

Section "InputClass"
        Identifier "evdev touchscreen catchall"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
EndSection

(See my post about xorg.conf for a later version (not Stable in the Portage tree yet) of X Windows on the Compal, Fixing unperceived errors in my X Windows configuration.)

I forgot to do the following:

# rc-update add dbus default
# rc-update add consolekit default

See the Gentoo Forums thread [ConsoleKit session] Failed to connect to socket (resolved) for the error message I was getting when the KDE Desktop appeared. In addition to the aforementioned error message, a window with a KDE Daemon crash message popped-up at log-in and KDE Plasma would crash when I dragged the System Tray widget to the Panel. Once the dbus and consolekit services were added to the default runlevel, all was good.

NetworkManager

After I merged NetworkManager I forgot to do:

# rc-update add NetworkManager default

but once I did that and the following:

# rc-update del net.enp4s0f1 default

then NetworkManager worked.

There was no /etc/NetworkManager/NetworkManager.conf, so I created that manually:

[main]
plugins=keyfile
dhcp=dhcpcd
no-auto-default=*

[keyfile]
hostname=clevow230ss

KDE plasma-nm crashes most times I try to create or edit a connection, so sometimes I have to edit the file /etc/NetworkManager/system-connections/* using nano. The current Stable version of plasma-nm in Gentoo is 0.9.3.4 and I believe the latest version of plasma-nm has fixed this bug, so eventually it should work correctly.

Audio

I followed Gentoo Wiki article ALSA and compiled ALSA into the kernel rather than modules. Card 0 is HDMI and Card 1 is HDA (the opposite to what is usually expected). KDE Multimedia settings worked when I selected Analogue Audio, but I had to install pavucontrol in order to be able to switch off HDMI and get audio in the Web browser etc. to be played via the laptop speakers/headphones. Later I will try the Gentoo Wiki ALSA article’s suggestion of adding snd-hda-intel.index=1,0 to the kernel boot line to switch the order of the cards.

Although I set what I think are the relevant MMC parameters in the kernel configration, the Memory Card slot does not work. Perhaps some kernel configuration settings remain to be set. I will have a look later. Gentoo Forums thread SD card under Gentoo Linux may help.

Bluetooth

Bluetooth is working after I made some kernel configuration settings and loaded the modules bnep, rfcomm and hidp via /etc/conf.d/modules (lsmod showed that btusb and bluetooth were already loaded automatically, but I added them anyway to /etc/conf.d/modules). I also had to do:

# rc-update bluetooth add default

The external portable USB portable CD/DVD writer (Samsung SE-208GB/RSBD) I bought from pcspecialist works well. I have tried it so far with an Audio CD, a data DVD and burning data to a CD-R.

Webcam

The built-in Webcam does not work. Update (April 29, 2015): I discovered today that the Webcam works fine; the problem was a bug in the version of the guvcview application I tried. So all is good. According to lsusb the Webcam is:

Bus 001 Device 010: ID 5986:055c Acer, Inc

The lsmod command shows the uvcvideo module is loaded. When I ‘rmmod uvcvideo‘ then ‘modprobe uvcvideo‘ the dmesg command shows the following:

[ 6508.624505] uvcvideo: Found UVC 1.00 device BisonCam, NB Pro (5986:055c)
[ 6508.627349] input: BisonCam, NB Pro as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0/input/input43
[ 6508.627425] usbcore: registered new interface driver uvcvideo
[ 6508.627427] USB Video Class driver (1.1.1)

The application guvcview displays a black window, and the Konsole from which guvcview was launched displays repeated ‘Ignoring empty buffer ...‘ messages:

$ guvcview
guvcview 1.6.1
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.0.28/work/alsa-lib-1.0.28/src/pcm/pcm_dsnoop.c:618:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.0.28/work/alsa-lib-1.0.28/src/pcm/pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.0.28/work/alsa-lib-1.0.28/src/pcm/pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.0.28/work/alsa-lib-1.0.28/src/pcm/pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.0.28/work/alsa-lib-1.0.28/src/pcm/pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.0.28/work/alsa-lib-1.0.28/src/pcm/pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
video device: /dev/video0
Init. BisonCam, NB Pro (location: usb-0000:00:1a.0-1.4)
{ pixelformat = 'MJPG', description = 'MJPEG' }
{ discrete: width = 640, height = 480 }
        Time interval between frame: 1/30, 
{ discrete: width = 160, height = 120 }
        Time interval between frame: 1/30, 
{ discrete: width = 176, height = 144 }
        Time interval between frame: 1/30, 
{ discrete: width = 320, height = 240 }
        Time interval between frame: 1/30, 
{ discrete: width = 352, height = 288 }
        Time interval between frame: 1/30, 
{ discrete: width = 640, height = 360 }
        Time interval between frame: 1/30, 
{ discrete: width = 1280, height = 720 }
        Time interval between frame: 1/30, 
{ discrete: width = 1280, height = 1024 }
        Time interval between frame: 1/30, 
{ discrete: width = 1920, height = 1080 }
        Time interval between frame: 1/30, 
{ discrete: width = 640, height = 480 }
        Time interval between frame: 1/30, 
{ pixelformat = 'YUYV', description = 'YUV 4:2:2 (YUYV)' }
{ discrete: width = 640, height = 480 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 160, height = 120 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 176, height = 144 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 320, height = 240 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 352, height = 288 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 640, height = 360 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 1280, height = 720 }
        Time interval between frame: 1/10, 
{ discrete: width = 1280, height = 1024 }
        Time interval between frame: 1/5, 
{ discrete: width = 1920, height = 1080 }
        Time interval between frame: 1/5, 
{ discrete: width = 640, height = 480 }
        Time interval between frame: 1/30, 1/15, 
{ pixelformat = 'RGB3', description = 'RGB3' }
{ discrete: width = 640, height = 480 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 160, height = 120 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 176, height = 144 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 320, height = 240 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 352, height = 288 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 640, height = 360 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 1280, height = 720 }
        Time interval between frame: 1/30, 
{ discrete: width = 1280, height = 1024 }
        Time interval between frame: 1/30, 
{ discrete: width = 1920, height = 1080 }
        Time interval between frame: 1/30, 
{ pixelformat = 'BGR3', description = 'BGR3' }
{ discrete: width = 640, height = 480 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 160, height = 120 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 176, height = 144 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 320, height = 240 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 352, height = 288 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 640, height = 360 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 1280, height = 720 }
        Time interval between frame: 1/30, 
{ discrete: width = 1280, height = 1024 }
        Time interval between frame: 1/30, 
{ discrete: width = 1920, height = 1080 }
        Time interval between frame: 1/30, 
{ pixelformat = 'YU12', description = 'YU12' }
{ discrete: width = 640, height = 480 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 160, height = 120 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 176, height = 144 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 320, height = 240 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 352, height = 288 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 640, height = 360 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 1280, height = 720 }
        Time interval between frame: 1/30, 
{ discrete: width = 1280, height = 1024 }
        Time interval between frame: 1/30, 
{ discrete: width = 1920, height = 1080 }
        Time interval between frame: 1/30, 
{ pixelformat = 'YV12', description = 'YV12' }
{ discrete: width = 640, height = 480 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 160, height = 120 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 176, height = 144 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 320, height = 240 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 352, height = 288 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 640, height = 360 }
        Time interval between frame: 1/30, 1/15, 
{ discrete: width = 1280, height = 720 }
        Time interval between frame: 1/30, 
{ discrete: width = 1280, height = 1024 }
        Time interval between frame: 1/30, 
{ discrete: width = 1920, height = 1080 }
        Time interval between frame: 1/30, 
vid:5986 
pid:055c
driver:uvcvideo
checking format: 1196444237
VIDIOC_G_COMP:: Inappropriate ioctl for device
fps is set to 1/30
drawing controls

fps is set to 1/30
Checking video mode 640x480@32bpp : OK
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
< Here I pressed Ctrl-C >
write /home/fitzcarraldo/.guvcviewrc OK
free controls
cleaned allocations - 100%
Closing portaudio ...OK
Closing GTK... OK

I tried all the available uvcvideo quirks (see Linux UVC driver and tools – FAQ: What are quirks and how do I use them?) but the result was always the same.

# rmmod uvcvideo
# modprobe uvcvideo quirks=0x00000200
# rmmod uvcvideo
# modprobe uvcvideo quirks=0x00000100
# rmmod uvcvideo
# modprobe uvcvideo quirks=0x00000080
# rmmod uvcvideo
# modprobe uvcvideo quirks=0x00000020
# rmmod uvcvideo
# modprobe uvcvideo quirks=0x00000010
# rmmod uvcvideo
# modprobe uvcvideo quirks=0x00000008
# rmmod uvcvideo
# modprobe uvcvideo quirks=0x00000004
# rmmod uvcvideo
# modprobe uvcvideo quirks=0x00000002
# rmmod uvcvideo
# modprobe uvcvideo quirks=0x00000001

There is possibly a bug in the uvcvideo driver (see [Kernel-packages] [Bug 1362358] Re: uvcvideo doesn’t work with USB webcam with linux 3.16), so I will have to try a later kernel at some point.

Update (April 29, 2015): I discovered today that nothing is wrong with the uvcvideo driver or the Webcam. The problem I described above was caused by a bug in the guvcview application itself. The Gentoo Stable version is guvcview-1.6.1, so I specified Gentoo Testing version guvcview-2.0.1 in /etc/portage/package.accept_keywords/guvcview and installed it, and now guvcview displays the Webcam output perfectly.

Transferring Thunderbird account settings and e-mails

My Compal laptop dual-boots Gentoo and Windows 7. Thunderbird is installed in both OSs, and both Windows Thunderbird and Linux Thunderbird use the same Mail folder on the NTFS Windows partition, but with different prefs.js files (i.e. Windows Thunderbird uses a prefs.js file on the Windows partition, and Linux Thunderbird uses a prefs.js file in the /home partition). In order to port my Thunderbird e-mails from the Windows partition on the Compal to the /home partition on the Clevo, I did the following:

  1. Installed Thunderbird on the Clevo.
  2. Launched Thunderbird and cancelled the Thunderbird wizard for creating a new account.
  3. Closed Thunderbird.
  4. Copied the Mail folder from the Compal’s Windows Thunderbird folder into the new Linux Thunderbird profile folder on the Clevo.
  5. Copied the prefs.js file from the Windows Thunderbird folder into the new Linux Thunderbird profile folder on the Clevo.
  6. Edited the prefs.js file to change all the Windows paths to Linux paths.

I also copied the three Address Book files abook.mab, history.mab and impab.mab across, but the first e-mail address in the Address Book differed between the two laptops so I exported the address books from Thunderbird in Linux (‘Address Book’ > ‘Tools’ > ‘Export…’ to create .ldif files) on the Compal and imported them into Thunderbird on the Clevo, but the result was no different to copying the .mab files, so it looks correct (the number of entries in the address books on each laptop was the same). Looking at a fresh installation of Thunderbird, I notice there is no impab.mab file, only the other two, and also the impab.mab file on the Compal has a 2011 date whereas the abook.mab and history.mab have current dates, so I wonder if the impab.mab file is redundant in the latest versions of Thunderbird.

A few panics (mine and the kernel’s!)

I had a couple of panic moments when rebooting after making changes to the kernel: if I had left a USB pen drive or a USB HDD plugged into the Clevo when I rebooted, the kernel would oops during boot-up. I initially thought these kernel panics were due to my mis-configuration of the kernel, but finally realised what was causing the oops when one of the error messages referred to a partition sdc1 on a pen drive. Actually, I had enabled too many kernel options in my first kernel build so it was probably better that I restarted the Gentoo installation anyway (I only restarted the installation from scratch once). The Compal boots normally if it has USB storage devices plugged in when it boots, so I’m not sure why it happens on the Clevo. Both laptops have the HDD first in the boot order, so I don’t know why the Clevo complains.

External monitor

I used xrandr commands to get my external monitor (an Acer AL1916W with a max resolution of 1440×900) to display the Clevo’s desktop correctly. I used the following command to view the available monitors and modes:

$ xrandr -q
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384
eDP-1-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 282mm x 165mm
   1920x1080     60.00*+  40.00  
   1400x1050     59.98  
   1280x1024     60.02  
   1280x960      60.00  
   1024x768      60.04    60.00  
   960x720       60.00  
   928x696       60.05  
   896x672       60.01  
   800x600       60.00    60.32    56.25  
   700x525       59.98  
   640x512       60.02  
   640x480       60.00    59.94  
   512x384       60.00  
   400x300       60.32    56.34  
   320x240       60.05  
VGA-1-0 disconnected (normal left inverted right x axis y axis)
DisplayPort-1-0 connected (normal left inverted right x axis y axis)
   1920x1080     60.00 +  40.00  
HDMI-1-0 disconnected (normal left inverted right x axis y axis)

I don’t know why the connected AL1916W monitor is shown as having only one display mode, and why that mode is 1920×1080. The AL1916W supports several modes up to 1440×900, and these are all displayed by the xrandr command on the Compal. It seems the NVIDIA driver is unable to read the external monitor’s EDID whereas the AMD ATI FGLRX driver is able to do so. Anyway I did the following to force the NVIDIA driver to display the Desktop correctly, which I later automated in a Bash script launched from a Desktop Configuration File:

$ xrandr --output DisplayPort-1-0 --off
$ xrandr --newmode "1440x900" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync # Only need to add new mode once per X session.
$ xrandr --addmode DisplayPort-1-0 1440x900
$ xrandr --output eDP-1-0 --off && xrandr --output DisplayPort-1-0 --mode 1440x900

I pressed the AL1916W monitor’s MENU button and selected AUTO to make sure the monitor’s display is as sharp as possible.

Scanners

I have an HP ScanJet 3400C scanner and my Canon PIXMA MP560 MFP also has a scanner. I had to install hplip in order to be able to use XSane, gscan2pdf and Simple Scan with the HP ScanJet 3400C scanner. I also found that the HP ScanJet 3400C must be switched off in order to be able to use the Canon MP560 scanner, whereas I don’t need to switch off the Canon MP560 in order to be able to use the HP ScanJet 3400C!

Skype and PulseAudio

As Qt 4.8.5 has not yet been marked stable in Gentoo, and therefore there is not a stable version of Qt with the abi_x86_32 USE flag, I installed Skype using the hack given by Gentoo user pablo_supertux in his Gentoo Forums post [SOLVED] Skype and the new multilib, which works well.

The laptop’s volume settings jumped to 100% periodically, and this is another of PulseAudio’s irritating quirks. To stop this happening I edited the file /etc/pulse/daemon.conf and changed:

; flat-volumes = yes

to:

flat-volumes = no

i.e. I uncommented the line and changed ‘yes‘ to ‘no‘.

I had disabled Skype from automatically adjusting audio settings. If I still find that PulseAudio is causing volume levels to change at start-up (see my earlier posts), I will create a script in /etc/local.d/ to set them automatically for me.

Things left for me to do:

  1. Get the Webcam working. Update (April 29, 2015): Done! It turned out there was nothing wrong with the uvcvideo driver or the hardware; the guvcview application had a bug. I installed a newer version of guvcview and it works correctly. So all is good.
  2. Get the Memory Card slot working. Boot SystemRescueCd and see if SDHC and/or SDXC memory cards are accessible. Update (April 28, 2015): Done! See my next post Realtek 5287 PCIe controller for memory card reader for the changes I made to the kernel configuration.
  3. Check the Bash backup scripts I created for the Compal and edit them if necessary so that they work on the Clevo. Update (April 29, 2015): Done!
  4. When Qt 4.8.6 is made Stable in the Portage tree, install Skype using Portage. Update (May 16, 2015): Done!
  5. Check which other applications and utilities I installed on the Compal need to be installed on the Clevo. Update (April 29, 2015): Done!
  6. Install the Samsung Unified Printer driver and get it working with the Samsung printers in the office. Update (April 29, 2015): Done!
  7. Investigate why the Clevo cannot print to my Canon PIXMA MP560 via WiFi. Update (May 15, 2015): Done! The problem was with the printer, not the Clevo. The printer was not always connecting to my home WiFi network.
  8. Install UFW and either a) the KDE KControl Module for UFW or b) UFW Frontends, and add firewall rules for Samba/CIFS and KDE Connect. Update (June 30, 2015): Done! Finally got around to doing it. ufw was giving an error message for IPv6, though, but I fixed that by rebuilding the kernel with some more parameters selected: CONFIG_NETFILTER_XT_TARGET_HL=m, CONFIG_IP6_NF_MATCH_RT=m and CONFIG_IP6_NF_TARGET_HL=m.
  9. Investigate why Samba cannot access the family Acer Aspire XC600 running Windows 8.1. The Samba service is running on the Clevo, and both Samba 3 and Samba 4 on the Compal can access shares on the Aspire XC600 and on the Clevo, so something must be wrong with the installation on the Clevo. Update (May 17, 2015): Done! The problem was that I had not merged kde-base/kdebase-kioslaves with the samba USE flag. Once I did that, Dolphin could browse Samba shares on the family PC running Windows 8.1.
  10. Find out the manual commands for switching between the Intel IGP and NVIDIA GPU that Gentoo user Arthanis mentioned in his post [SOLVED] Optimus and Nvidia. Update (June 30, 2015): Done! See the latest post in the aformentioned Gentoo Forums thread. Sometime in the next month or so I’ll post in this blog the full details of my solution.
  11. Investigate why the KDE Network widget plasma-nm is crashing when I add/edit connections (see a recent KDE blog post Plasma-nm 0.9.3.6 release about the last update to plasma-nm-4.* which fixes some bugs). I suppose I need to wait for plasma-nm-0.9.3.5 to become stable in the Portage main tree. Update (April 30, 2015): Done! I got fed up with the buggy ‘Stable’ plasma-nm-0.9.3.4 so I added plasma-nm-0.9.3.5 to /etc/portage/package.accept_keywords/plasma-nm and Version 0.9.3.5 is no longer crashing.
  12. Get qr-tools (QR Code application) working on the Clevo. Update (April 29, 2015): Done!

Update (September 24, 2016): I upgraded xorg-server from 1.17.4 to 1.18.4 today and had to change the following line in /etc/X11/xorg.conf:

Screen 0 "nvidia" 0 0

to:

Screen 1 "nvidia" 0 0

See the Gentoo Forums post What’s up with xorg-server 1.18 and Optimus? for further details