Archive for the ‘Stuff’ Category

Xubuntu User “Face” or Avatar on GDM login screen

Sunday, February 13th, 2011

There doesn’t appear to be a way within settings to add a user image to the gdm user login screen, but this can be resolved in a simple way:

Get your image or avatar, make sure its a sensible size e.g. 96×96 pixels.

Copy it to your home directory

Rename it .face

Logout and then see your new avatar on the login in screen.

The same icon also shows up when you go into Users and Groups.

Simples :)

PS2 Eyetoy Webcam on Xubuntu 10.10 Recording and Playback

Sunday, January 9th, 2011

More fun to be had with your PS2 eyetoy as webcam. This all was tested using the silver eyetoy, but I see no reason why the black one won’t function just the same.
(Remember this is without pulseaudio!)
(a copy of the post I made on Ubuntuforums)
Recording Sound:

First off, define which device is generating the sound from the microphone

Code:

aplay -l

This tells me my eyetoy microphone is card 1, device 0, which translates to plughw:1,0. To record sound from the mic enter this command in a terminal:

Code:

arecord -f cd -t wav -c 2 -D plughw:1,0 foobar.wav

This records a wav file at CD quality.

Video Playback:

Lots of choices here:

Code:

mplayer tv:// -tv device=/dev/video0

Code:

cvlc v4l2:///dev/video0

and the monster that is gstreamer (you’ll need to ensure gstreamer-tools is installed)

Code:

gst-launch v4l2src device=/dev/video0 ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! xvimagesink

Capturing Video - Video and Sound:

This proved harder than I thought as vlc, ffmpeg and mencoder flatly refused to do the job with all the command lines I found out on google.

Using gstreamer again, although this is a bit unwieldy:
Capture Video only (no concurrent playback):

Code:

gst-launch v4l2src device=/dev/video0 ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! queue ! videorate! 'video/x-raw-yuv,framerate=30/1' ! theoraenc ! queue ! oggmux ! filesink location=output.ogg

Capture Video and Sound (with concurrent playback):

Code:

gst-launch v4l2src ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! tee name=t_vid ! queue ! videoflip method=horizontal-flip ! xvimagesink sync=false t_vid. ! queue ! videorate ! 'video/x-raw-yuv,framerate=30/1' ! queue ! mux. alsasrc device=plughw:1,0 ! audio/x-raw-int,rate=48000,channels=2,depth=16 ! queue ! audioconvert ! queue ! mux. avimux name=mux ! filesink location=output.avi

FFMPEG
Capture Video and Sound (variants on):

Code:

ffmpeg -t 10 -f video4linux2 -s 640x480 -r 15 -i /dev/video0 -f alsa -ac 2 -i plughw:1,0  -aspect 4:3 -s 720x400 -qscale 3 video-with-sound.flv

Code:

ffmpeg -t 10 -f video4linux2 -s 640x480 -r ntsc -i /dev/video0 -f alsa -ac 2 -i plughw:1,0 -qscale 3 video-with-sound.avi

Just video:

Code:

ffmpeg -f alsa video4linux2 -s 720x480 -r 30000/1001 -i /dev/video0 -sameq -aspect 4:3 -f avi -vcodec mjpeg -r 30000/1001 -y output.avi

Enjoy

Acer Aspire 110L Netbook CLI Installation

Monday, January 3rd, 2011

Did this a couple of years ago, forget what I did, so wrote it down this time. Had a bit of a fight getting the framebuffer up and running, but finally found the right blog post!

Distro:
Xubuntu 10.04 LTS ALT CD

Wired Connection (to start with)

#Apps
moc
mc
mplayer
fbi
htop
e-links
alpine

#Installs
openssh-server
screen
portmap
nfs-common
hwinfo
alsaequal + caps + libasound2-dev + libasound2-plugins + swh-plugins
aria2
wicd-curses
alsa-utils
build-essential
v86d

#Tweaks to Framebuffer

#edit /etc/default/grub
#add as follows:

GRUB_COMMAND_LINE_DEFAULT= nomodeset video=intelfb:mode_option=1024×600-24,mtrr=3,scroll=ywrap  (plus whatever else you want there)

GRUB_GFXMODE=1024×600
GRUB_GFXPAYLOAD_LINUX=1024×600

#in terminal:
sudo update-grub2

#edit /etc/initramfs-tools/conf.d/splash
#and add:
FRAMEBUFFER=yes
#or in terminal:
echo FRAMEBUFFER=y | sudo tee /etc/initramfs-tools/conf.d/splash
#then:
sudo update-initramfs -u

#reboot

#Tweaks to wicd
#It fails to start the network connection manager on installation added static IP, but it still takes a minute or two to make the connection, after that solid and quick to try manual config next

#Tweaks to Grub2
#see above for framebuffer
#only other change was to reduce grub timeout to 3:
#in terminal:
sudo nano /etc/default/grub
#edit as below:

GRUB_TIMEOUT=3

#in terminal:
sudo update-grub2

#Tweaks to mplayer
#Found that I needed to use vo=fbdev2 to play back movies on the framebuffer
#Also doesn’t completely take over when scale=1024:-3 & fs=yes is used so having to run setterm -cursor off blank 0,
#however in most situations will use video at fullscreen
#config file (in ~/.mplayer/config) as follows:
#in terminal:
nano ~/.mplayer/config
#add the following:

###
#gives proportionate scaling and centres on screen
#fs=yes
#vf=scale=1024:-3
####
#gives fullscreen :)
vf=scale=1024:600
###
vo=fbdev2
dr=yes
double=yes
framedrop=yes
ontop=yes
cache=8192
lirc=no
alang=en
slang=en
ao=alsa
#cuts down on the chatter - comment out if you need to debug
really-quiet=yes

#Tweaks to NFS
#Of course ensure portmap and nfs-common are installed on the AA0, and you have a working nfs server serving up shares you can connect to!
#Just did the usual, created mount points in /media and setup nfs shares in my fstab
#for example:
#in terminal:
sudo mkdir /media/films

#in fstab:

myserver:/films    /media/films    nfs    rsize=8192,wsize=8192,timeo=14,intr,bg

#Tweaks to AA0
#Fan Control - basically shuts it up
#acerfand / acer_ec.pl
#see acer fan post

#Hot plugging for SD cards
#in terminal:
sudo nano /etc/modprobe.d/aa0-fix-sd-slots.conf
#add the following content:

# Enable USB card reader
options pciehp pciehp_force=1
install sdhci for i in 2381 2382 2383 2384; do /usr/bin/setpci -d 197b:$i AE=47; done; /sbin/modprobe –ignore-install sdhci

#Then edit /etc/modules:
#in terminal:
sudo nano /etc/modules
#add the following to the end of the file:

#fixes SD slots
pciehp

#reboot

#Tweaks to alsaequal

#Create/edit ~/.asoundrc
#in terminal:
nano ~/.asoundrc

ctl.equal {
type equal;
}

pcm.plugequal {
type equal;
slave.pcm “plug:dmix”;
}

#switch the commenting of the next two lines if you don’t want alsaequal as your default soundcard
#pcm.equal {
pcm!.default {
type plug;
slave.pcm plugequal;
}

#force-reload all your alsa modules:
#in terminal:
sudo alsa force-reload
#and start EQing with:
#in terminal:
alsamixer -D equal

#starting up moc with mocp, then playing music, press q, moc goes away but music carries on, then:
#in terminal:
alsamixer -D equal
#and play with the settings until you are happy

#alsaequal does tend to use a fair few cpu cycles, moc running at @ 25% CPU.

#Tweaks to

I’ll have a proper play with alpine and elinks later

Zenity Exit / Shutdown Script for Openbox

Saturday, January 1st, 2011

Finally got around to doing this.

Use the zip file included at the bottom, as all the double hyphens get lost on this blog.
Also, depending on with version of zenity you have (e.g. on Debian Squeeze / #!-10), you may need to remove the  “- - no-cancel” options in the second half of the script. Enjoy :)

#!/bin/bash
# Multiple Exit Script using Zenity for non GDM installs
# Requires zenity and an edit to sudoers to allow all users to use the shutdown command
# As follows:
#
# Open a terminal
# EDITOR=nano
# sudo visudo
# Scroll to bottom of file and add this: (not the #)
# ALL ALL=NOPASSWD:/sbin/shutdown
#
######## This part is the Exit Type picker  ##########

title=”EXIT: What do you want to do ?”
exit_type=`zenity  –width=”530″ –height=”220″ –title=”$title” –list –radiolist –column=”Click Here” \
–column=”Exit Type” –column=”Description” \
TRUE “Logout” “Log Current User out and return to Login Screen”\
FALSE “Reboot” “Reboot the PC”\
FALSE “Shutdown” “Shutdown the PC”\
FALSE “Cancel” “Cancel the Exit” \
| sed ’s/ max//g’ `

echo “$exit_type chosen as the Exit Type!.”

#user must select a target type (Check if they cancelled)
if [ ! “$exit_type” ]; then
zenity –error –title=”Error” –text=”You must make a selection!”
exit
fi

######### This part takes the selection and applies it!  #############

# Edit this first section if not using openbox! #
if [ “$exit_type” = “Logout” ]
then
# Do logout here.
openbox –exit && sleep 1 | zenity –progress –percentage=95 –title=Logout –auto-close –auto-kill –no-cancel –width=300

elif [ “$exit_type” = “Reboot” ]
then
# Do Reboot here.
sudo shutdown -r now | zenity –progress –percentage=95 –title=Reboot –auto-close –auto-kill –no-cancel –width=300

elif [ “$exit_type” = “Shutdown” ]
then
# Do Shutdown here.
sudo shutdown -h now | zenity –progress –percentage=95 –title=Shutdown –auto-close –auto-kill –no-cancel –width=300

else

#if [ “$exit_type” = “Cancel” ]
#then
# Do Cancel here.
sleep 1 | zenity –progress –percentage=95 –title=Cancelling Exit –auto-close –auto-kill –no-cancel –width=300
fi

exit.zip

Fix the Noisy Fan on an Acer Aspire One

Friday, December 31st, 2010

There are two ways of doing this, depending upon the bios and kernel you are using

1. For older bios’ <3309 or for setups with an older kernel (say pre Ubuntu 10.04)

This is an oldie but goodie, thanks to netbook tech for guidance on this

#Download as follows:
wget http://electronpusher.org/~rachel/acerfand
wget http://aceracpi.googlecode.com/svn/trunk/acer_ec/acer_ec.pl

#Copy both files to /usr/local/bin
sudo cp acerfand /usr/local/bin/
sudo cp acer_ec.pl /usr/local/bin/

#Make acerfand executable
sudo chmod 755 /usr/local/bin/acerfand

#Add acerfand to your rc.local so that it fires up on boot
sudo nano /etc/rc.local
place /usr/local/bin/acerfand at the bottom of the file, before the exit 0

#Restart

#Configure
edit acerfand at your peril :)
or create an /etc/acerfand.conf with the following content:

INTERVAL=5
FANOFF=60
FANAUTO=70

These are the default values, temps are in celcius

This makes my setup with 10.04 LTs and bios 3310 shutdown after @ 30 seconds, so…

2. for newer bios > 3309 of newer kernels > Ubuntu 10.04+

This method can be u tried on older setups if 1. doesn’t work. From 2.6.31 this is included in the mainline kernel

Download this file:

wget http://www.piie.net/files/acerhdf_kmod-0.5.25.tar.gz

tar zxvf acerhdf_kmod-0.5.25.tar.gz
cd acerhdf_kmod
make
sudo make install

You might need to install you linux headers for your kernel to make/make install

Add acerhdf to /etc/modules so that it runs on boot

Run this command as root:

sudo -i

echo -n “enabled” > /sys/class/thermal/thermal_zone0/mode

Now test by running

sudo modprobe acerhdf

“Minimal” Install - Xubuntu 10.04 LTS - Openbox

Thursday, December 30th, 2010

As per a previous post, here is a breakdown of the installation carried out on a Dell Dimension 4100 with an PIII 833mhz processor and 256mb ram:

#XUBUNTU 10.04 LTS ALT CD
#On Install screen press F4 and select Command Line Install
#then Install Xubuntu

#UPDATE - RUN THIS AGAIN AFTER CONFIGRATION
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

#APPS
sudo apt-get install openbox openbox-themes tango-icon-theme-extras xorg obmenu obconf thunar firefox xfce4-terminal –no-install-recommends

sudo apt-get install arandr build-essential feh gdebi hicolor-icon-theme htop libxmu-dev libpng-dev libjpeg-dev g++ libxft-dev mousepad openssh-server portmap nfs-common mplayer-nogui mencoder audacious devilspie zenity htop ffmpeg rar cups-pdf python-software-properties synaptic tango-icon-theme thunar-volman thunar-archive-plugin unrar update-manager vlc wbar xubuntu-restricted-extras wicd gksudo

#APP ALTERNATIVES
#Music players: potamus, moc, cmus, alsaplayer
#File Managers: pcmanfm, mc
#Browsers: chromium, midori, elinks
#Useful tools: winff (video/audio conversion), clicompanion, xfburn, aria2 (downloader), fireftp/filezilla (ftp), geany (development), mirage/gthumb (image mgt), remmina (vnc client), I could go on, but this IS meant to be a minimal install!

#SCREEN RESOLUTION CHANGER
arandr

#PANEL
sudo add-apt repository ppa:killeroid/ppa && sudo aptitude update && sudo aptitude install tint2
#follow this guide and example conf file for tint2
nano ~/.config/tint2/tint2rc

#DOCK
wget http://www.ihku.biz/wbarconf/wbarconf_0.7.2-1_i386.deb
#this following command may refuse, in need of dependencies
sudo dpkg -i ~/wbarconf_0.7.2-1_i386.deb
#so run this
sudo apt-get install -f
#then the install command again
sudo dpkg -i ~/wbarconf_0.7.2-1_i386.deb
#run wbarconf and add your preferred apps to the dock
wbarconf
#to prevent windows from crashing the dock, set the top margin of the screen to @ 40 pixels

#LOGIN MANAGER
wget http://download.berlios.de/slim/slim-1.3.2.tar.gz
#follow instructions here:
#if you swap out the background image for slim with the same one for your desktop, you get a seamless flow from login to desktop

#ICON THEME
#the default icon theme is grey and bland so change it to Tango
nano ~/gtkrc-2.0
#add this to the file you have created to get the Tango icon theme:
gtk-icon-theme-name = “Tango”
#for the Tango icon theme

#GRUB
#adjust settings for grub menu such a countdown timer
sudo nano /etc/default/grub
sudo update-grub2

#DESKTOP BACKGROUND
#Find yourself a background
#open it with feh
#use the feh right click menu to set it as background
#do the startup routine to set background on startup
#see login manager about matching backgrounds

#STARTUP ROUTINE
nano ~/config/openbox/autostart.sh
#add the following
eval `cat $HOME/.fehbg` &
tint2 &
wicd &
sleep 6 &
wbar &

#RIGHT CLICK MENU
obmenu
#for apps that run in terminal use “xfce4-terminal -x nameofapp”
#to maximise app use “xfce4-terminal –maximize -x nameofapp”
for synaptic use “gksudo synaptic”

#WINDOW THEME
obconf

#CREATE NEW USER WITH SAME CONFIGURATION
#a new user created normally would have the basic configuration that you started with.
see here:

Recording with ALSA staring me in the face (and midi playback)

Tuesday, December 28th, 2010

Finding the right app to record stuff is a bit of a pain on linux, and playing back midi files can be a trial also. But everything you need is right there in your alsa-utils package. Open up a terminal and let’s get going!

Recording from a microphone:

 arecord -f cd -t wav -c 2 -D plughw:1,0 foobar.wav

This will record you microphone input from your chosen soundcard (in this case card 1, device 0) at 2 channel CD quality, outputting to a wav file for you to play with later. To playback your recording:

aplay foobar.wav

For more information and options, simply type:

man aplay

OK, to play back midi files, you may need to ensure you have timidity installed. Then find a midi file (*.mid) or a kar file (*.kar) and download it. Then it is simply:

 aplaymidi -l

to find an open port, in my case 128:0, then:

 aplaymidi mymidifile.mid

If you want to get the best out of kar files, then install pykaraoke, it will play back the midi and highlight the lyrics through the song :)

Linux - Listen to Microphone on remote PC

Sunday, December 26th, 2010

Due to the festive season there was a need to contact relatives in far flung places. Of course I hadn’t done any preparation, so things didn’t work as I wanted. I plugged a PS2 Eyetoy into my htpc, and installed Skype. Was pleased to see the video worked off the bat, but when contacting my first relly, I could see and hear them, they could see me, but could not hear me. The mic on the Eyetoy wasn’t configured correctly. Due to my work with special needs kids, I put my sign language (Makaton) skills (limited!) to good use, and we had a fun conversation as I taught my rellies sign language using sign language :)

Anyway set about reconfiguring my htpc to get the mic working later that evening. It’s a Ubuntu 10.10 setup, so I removed pulse audio, and got back to a basic alsa setup. (Note: my main PC is set up the same way) I did all the setup via ssh from my main desktop. Needed a way to test my microphone was working:

arecord -l

gave the the number of my device:

card 1: Namtai [EyeToy USB camera Namtai], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

I then tracked down via google a command that with some modification allowed me to listen to the microphone on the speakers on my main PC (in a another room). I put my smartphone next to the eyetoy, and set it to play an audiobook I had on it. Ran back to my study and ssh’d into the htpc. Once there I had to run the command, which included ssh’ing back to my main PC (bet that would confuse 2 windows PCs if you tried it!) Command all on one line:

 arecord -f dat -D plughw:1,0 | ssh -C bimma@10.10.10.10 aplay -f dat

and blow me, the sound of my audiobook being “listened to” by the microphone came through loud and clear on my main PC speakers

Key things: getting the device right, the arecord -l command gave the information of card 1 and device 0, which translates to plughw:1,0 (the -D option denotes the device for arecord to listen to), and -f dat indicates the format the sound will be recorded in and relayed to the remote PC. Have a good read of man aplay, for more info.

Now to try things out on a different relly tomorrow ;)

Top Ten Best Linux Distros?

Wednesday, December 22nd, 2010

KMandla’s been getting all hot under the collar about Tech Radar’s distro list, so I thought I would have a go:

  1. Xubuntu 10.04 LTS / 10.10
  2. Ubuntu ALT-CD Command Line Installation with Openbox Window Manager
  3. SLiTaZ 3.0
  4. PartedMagic 5.0
  5. Arch Linux
  6. Puppy Linux 5
  7. Crunchbang Linux
  8. XBMC Live
  9. Clonezilla
  10. Struggling here; a toss up between Mint, UNR and Windows 7 :)

No place for Tiny Core Linux, but there, it gets a mention.

I do have modern PC hardware ;)

SLim Struggle ! SLiM Simple Login Manager on Minimal Xubuntu 10.04 LTS

Wednesday, December 22nd, 2010

A couple of ancient PCs came into my possession, so I thought I would have a go at setting them up for passing on to new PC users / first timers. The “better” of the two an Athlon XP 1500 with 768mb ram handled full Xubuntu 10.04 LTS just fine, but the Dell Dimension 4100, PIII 833mhz with 256mb ram needed a different approach. So out with the ALT-CD and a command line install ensued, followed by an openbox window manager setup. The majority of packages I installed were done with the no-install-recommends switch.

As this machine was for a new user, I had to make things simple, so thought they might benefit from a login manager, and as usual I turned to SLiM. After installing build-essential, I downloaded the source for SLiM and set about compiling it.

wget http://download.berlios.de/slim/slim-1.3.2.tar.gz

tar xzvf slim-1.3.2.tar.gz

cd slim-1.3.2

Blocker number 1:

needed some dev dependencies. Tracked them down, and then the compile completed.

sudo apt-get install libxmu-dev libpng-dev libjpeg-dev g++ libxft-dev

make (still in directory slim-1.3.2)

sudo make install

Blocker number 2:

rebooted to find that SLiM had not fired up (which it had with every install I have ever done.) So stuck /usr/bin/slim into rc.local (above exit 0), and rebooted again. Success SLiM popped up

Blocker number 3:

SLiM would not log me in. So I dived into /etc/slim.conf and edited the login_cmd section to point to an openbox session. Rebooted again and I was finally in. The command below is all on one line.

login_cmd           exec /bin/bash -login /etc/X11/Xsession openbox-session

I’ll put this down to the minimal install and the use of –no-install-recommends switch