Troels Kofoed Jacobsen’s blog


Sound and multimedia keys on FreeBSD
May 26, 2009, 8:40 pm
Filed under: FreeBSD | Tags: , ,

This post is part of the series: FreeBSD on my laptop

This on is pretty easy. Basically I just had to load the driver. This is done permanently by adding:

snd_hda_load="YES"

to /boot/loader.conf.

In kde the phonon framework locks the sound channel. Thus I enable 4 channels in total, so I can also get sound from non-kde apps like firefox/flash and virtualbox. This is done with the following lines in /etc/sysctl.conf
dev.pcm.0.play.vchans=4
dev.pcm.0.rec.vchans=4

To enable the multimedia keys (mute, volume up, volume down) I had to define the correct mapping for X. This is done with the following commands:

xmodmap -e 'keycode 140 = XF86AudioMute'
xmodmap -e 'keycode 176 = XF86AudioRaiseVolume'
xmodmap -e 'keycode 174 = XF86AudioLowerVolume'

I added this to a (executable) script in ~/.kde4/Autostart. Another possiblity is to add it to .xprofile or something. The actual keycodes have been found using xev: just open it in a terminal and start pressing keys. It will then tell you the keycodes.

Resources:
The FreeBSD Handbook, 7.2 Setting Up the Sound Card



Usable tcsh
May 19, 2009, 11:06 am
Filed under: FreeBSD | Tags: , , ,

This post is part of the series: FreeBSD on my laptop

In this post I will try to document how I set up tcsh to my liking by modifieng .tcshrc. I have left out a lot of stuff, like how I have set my EDITOR variable and stuff, but you can find the .tcshrc file attached (not possible to attach text files)

First I alias grep and ls, to get some nice colors:

alias grep grep --color=auto
alias ls ls-F

Now comes the setup of the shell itself.

set addsuffix
set autolist
set cdpath = $HOME
set color
set nobeep
set rmstar
set history = 250
set histfile = "$HOME/.history"
set savehist = ( 125 merge )
set prompt = '%{33[1;33m%}[%T]%{33[0m%} %{33[32m%}%n%{33[0m%}@%{33[31m%}%m%{33[0m%} %{33[36m%}%c%{33[0m%} %# '
source /usr/share/examples/tcsh/complete.tcsh

bindkey "^[[3~" delete-char
bindkey -k up history-search-backward
bindkey -k down history-search-forward

addsuffix adds a ‘/’ when autocompleting directory names and autolist prints out all possibilities when there is more than one available.
cdpath allows one to type e.g. ‘cd Desktop’ from everywhere! You don’t have to be in $HOME/.
color adds color support to ls using the alias above.
nobeep disables the annoying beeping sound when doing something that would do that.
rmstar guards against ‘rm *’ and will prompt the user for confirmation.
the hist lines is just for saving the history
prompt gives a nice colour prompt showing a timestamp, username and hostname.
source ../complete.tcsh enables autocompletion of a lot of nice stuff.

the bindkeys just modifies some keybindings. The up and down keys now searches through the history so if you press e.g. scp it scroll back your last commands starting with scp!! really nice (just like in Matlab).

This is it for now, maybe more will be added.

Note that since my terminal emulator, konsole, cannot find the program names under FreeBSD with tchs (haven’t investigated further) I had to make make it set the tab title form the “Window title set by Shell”.



FreeBSD on my laptop
May 19, 2009, 10:44 am
Filed under: FreeBSD | Tags: , ,

I am currently trying to get FreeBSD up and running on my HP nc4400 laptop. Up until now it’s going pretty well, but there is lots of small tips and tricks to remember. Therefore I’m writing a series of posts do document the steps I’ve taken. This is as much for my self to remember as it is for everyone to use.

Here’s a preliminary list of things to take care of:

Note that there is no bullet point for Xorg. This is because the newest Xorg configures itself with no xorg.conf. Only settings for e.g. the touch pad should be done manually.

Remember that FreeBSD is wonderfully documented in the handbook and in the man pages. Most of the information for these posts I got from these.

Other useful resources: