C and C++ completion with vim and clang

There is a “new” plugin around that uses clang directly to integrate some nice completion for C and C++ into vim.

It’s called clang_complete and can be found on GitHub. You should use a current clang version tho, because some GCC parts already use the new C++11 standard and older clang versions will fail to build against those parts.

" clang
" highlight the warnings and errors
let g:clang_hl_errors=1
" open quickfix window on error
let g:clang_complete_copen=1
" use libclang directly, fast due to caching
let g:clang_use_library=1
" tell clang_complete where to find libclang
let g:clang_library_path = '/usr/lib/llvm/'

clang_complete should automatically run on certain input like std::, but you can also run it manully via C-X C-U.

You can find additional documentation in the git repository.

Sony VPCZ1 (also known as VPCZ11C5E), Update 1

Since about mid October the ‘drm-intel-next’ tree is working again with the Sony VPCZ1. At first there were some issues with suspend to ram (and probably also Suspend to Disk, tho I never tried the latter), that manifested themselves in a black screen after resume which could be fixed by turning the display off and on again via xrandr. Luckily, it was fixed quite fast by Jesse Barnes. The corresponding bug report is: [Bug 30738] So at the moment, everything seems to be working, except switching graphics.

Power consumption:

I’m also fiddling with a few settings that influence power consumption and am currently getting a long term estimate of 11.6W via PowerTop (and Power usage: 12.7W),when I’m working in a terminal with wireless turned on.This is with CONFIG_INTEL_IDLE set to ‘y’, I’ll test the default acpi_idle driver later on.

Sony VPCZ1 (also known as VPCZ11C5E)

This is intended as a small summary post about the VPCZ1 under (Arch) Linux, I guess I’ll update it as I go. Warning: Some commands in this post might damage your laptop, so please only execute them, if you know what you are doing!

Graphics:

The internel Intel Graphics card should be working fine with a current drm-intel-next kernel, the Nvidia card is a bit of a problem tho. But there seem to be a few ways to get it working.

  • Extract and change your DSDT to activate the correct card.
  • Patch the installed BIOS to get all the advanced menus and activate static graphics switching (that’s what I did).  Link.
  • Boot an older Kernel with the switch in the desired position and reboot again to get only that card activated. I also heard that setting acpi_osi=”!Windows 2006″ works fine.

One thing that won’t work with the Nvidia card is brightness control, as it seems to be controlled by the Intel card. By the way, the HDMI port only works with the Nvidia card.

Be aware that the laptop will generate quite a bit more heat when both graphic cards are turned on as reported in this thread: Z11 too warm

Update:

It seems to be possible to de/activate the Nvidia card with the ACPI function “_SB.PCI0.P0P2.DGPU._OFF/_ON” and check the satus with “_STA”. One thing it won’t do is to remove it from lspci, but I’m not sure how the devices are listed (ie. how static that list is).

Suspend to RAM:

Works fine for me, except that the panel isn’t reactivated after resume, which can be fixed with xrandr and a small resume handler script in /etc/pm/sleep.d (don’t forget to make it executable):

#!/bin/sh
case $1 in
    hibernate)
        # echo "Hey guy, we are going to suspend to disk!"
        ;;
    suspend)
        # echo "Oh, this time we're doing a suspend to RAM. Cool!"
        ;;
    thaw)
        # echo "oh, suspend to disk is over, we are resuming..."
        ;;
    resume)
	echo "Restoring panel/display."
	XAUTHORITY_FILE="/home/jan/.Xauthority"
	if [ -e "$XAUTHORITY_FILE" ]
	then
	    XAUTHORITY=$XAUTHORITY_FILE DISPLAY=:0 xrandr --output DP3 --off
	    XAUTHORITY=$XAUTHORITY_FILE DISPLAY=:0 xrandr --output DP3 --auto
	else
	    DISPLAY=:0 xrandr --output DP3 --off
	    DISPLAY=:0 xrandr --output DP3 --auto
	fi
        ;;
    *)  echo "somebody is calling me totally wrong."
        ;;
esac

Suspend to disk:

Not tried yet, but I assume that it works fine. ;)

GPS:

The Gobi 3000 works fine with the gobi_loader, getting the firmware etc. is a bit tricky, but there are quite a few tutorials around the web. It’s also possible to boot into a Windows that has the Gobi driver installed and just reboot into Linux, as the firmware will still be loaded after the reboot. I’m currenty using wvdial to connect to my provider, works like a charm.

Sound, SD card reader:

Works out of the box.

Keyboard and Touchpad:

The touchpad should work fine with a current kernel, otherwise you can set “i8042.reset i8042.nomux i8042.nopnp i8042.noloop” on the kernel parameter line.

HP Proliant Support Pack annoyance

I found a rather annoying behavior with the current PSP for  RHEL (v8.31).  The host I wanted to install it on is a CentOS 5.4, with a modified ”/etc/redhat-release” to match the current RHEL release. Usually that’s the only problem with installing the PSP on a CentOS system.

But as it turns out you can’t have the ”hpsmh” user and group in your LDAP to which the server is connected, it’ll just fail horribly. If you take a closer look at the ”hpsmh” RPM you’ll see that it checks ”/etc/passwd” for an already existing user and it’s main group, saves their ids and then deletes both just to add them again later.

The problem is that it just uses ”grep” to search for the user, hence it will find none, but using ”useradd” to add a “new” ”hpsmh” user will obviously fail, because useradd does know about the LDAP user.

This is all rather annoying for companies (or rather their IT departments) that want to control the uid and gid allocation to the last bit.

Building python 2.6.4 with SSL on a Solaris 10 system

If you have your OpenSSL in some special location, you have to set your LD_LIBRARY_PATH accordingly. I just set it in the environment of the shell, but it should also work when set in the Makefile.

Just having it installed in “/usr/local/ssl” isn’t enough, the build script will look there for the “ssl.h”, but that’s it.

This is the error that’s displayed when LD_LIBRARY_PATH is not set correctly:

cc  -o python \
                 Modules/python.o \
                 libpython2.6.a -lsocket -lnsl -lrt -ldl  -L/usr/local/ssl/lib -lssl -lcrypto    -lm
ld.so.1: python: fatal: libssl.so.0.9.8: open failed: No such file or directory
Killed
make: *** [sharedmods] Error 137

DSEE 6.3 and certificates

It seems that the DSEE 6.3.1 doesn’t care about the validity of the used certificates, at least not after they’ve been imported/added. I used an expired certificate for about 5 days without any problem. When I rebootet the directory server, it didn’t even complain about the certificate, all the clients (Solaris 10 u6 [zones]) that were using SSL/TLS didn’t work properly, tho.

Interestingly, it was even affecting one zone that I reconfigured to use just the “simple” authentication method.