Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Tuesday, April 15, 2008

Audacious. Gnome. Multimedia keys.

Unfortunately, multimedia keys don't work in Audacious plug-ins like global hotkeys if ones were binded in gnome-keybinding-properties application. I wrote the following plug-in to enable multimedia keys (play, stop, prev, and next) in Audacious player. The plug-in was tested in Ubuntu 7.10. Here is it:
Audacious - Gnome Mmkeys

Friday, April 11, 2008

Ubuntu 7.10 + Jabra BT620s + Jabra 320s

I have bought bluetooth headphones and adapter. Here is an instruction how to configure bluetooth audio under Ubuntu 7.10. Maybe it will be helpful for other distros.

At first you should obtain MAC for you bluetooth audio device:

hcitool scan

Obtained address you should replace in scripts and configuration below instead of "XX:XX:XX:XX:XX:XX".

Create the following file in home directory to configure alsa plug in:
~/.asoundrc
pcm.bluetooth {
type bluetooth
device XX:XX:XX:XX:XX:XX
profile "auto"
}

Then create python scripts. The first script turns on headset profile, the second one turns on A2DP profile for stereo streaming.

Headset proifle (headset.py file):

#!/usr/bin/env python

import dbus
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'), 'org.bluez.Manager')

bus_id = manager.ActivateService('audio')
audio = dbus.Interface(bus.get_object(bus_id, '/org/bluez/audio'), 'org.bluez.audio.Manager')

path = audio.CreateHeadset('XX:XX:XX:XX:XX:XX')
#audio.ChangeDefaultHeadset(path) #change the device to be used by default
headset = dbus.Interface (bus.get_object(bus_id, path), 'org.bluez.audio.Headset')

#Connect and Play are not required in PCM mode
headset.Connect()
headset.Play()

A2DP profile (a2dp.py file):

#!/usr/bin/env python

import dbus
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'), 'org.bluez.Manager')

bus_id = manager.ActivateService('audio')
audio = dbus.Interface(bus.get_object(bus_id, '/org/bluez/audio'), 'org.bluez.audio.Manager')

path = audio.CreateDevice('XX:XX:XX:XX:XX:X')
#audio.ChangeDefaultDevice(path) #change the device to be used by default
sink = dbus.Interface (bus.get_object(bus_id, path), 'org.bluez.audio.Sink')

sink.Connect()

Okay. bluetooth-applet should be run. To turn on A2DP profile you should execute a2dp.py and to turn on Headset profile you should execute headset.py. Now you can test sound via audacious: options->preferences->Audio->Current Output Plugin->ALSA
Output Plugin Preferences->Device Settings->audio device: "bluetooth". In other players you should select "bluetooth" device instead of default or any other. See here how to set bluetooth support to another players.

Another way to set bluetooth support is to install Blueman manager.

URLs:
UPD: Audacous writes to console: ALSA lib pcm_bluetooth.c:238:(playback_hw_thread) poll error: Interrupted system call (4). I don't know what it means...

Monday, April 07, 2008

#! /bin/bash
# eth0 - local network
# ppp0 - internet
# eth1 - home wnetwork

IPTABLES=/sbin/iptables

echo 1 > /proc/sys/net/ipv4/ip_forward

# Clearing
$IPTABLES -P INPUT ACCEPTs
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD
$IPTABLES -t nat -F

$IPTABLES -t nat -A POSTROUTING -o eth0 -j MASQUERADE
$IPTABLES -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

$IPTABLES -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPTABLES -A FORWARD -i eth1 -o eth0 -j ACCEPT
$IPTABLES -A FORWARD -i ppp0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPTABLES -A FORWARD -i eth1 -o ppp0 -j ACCEPT

Sunday, March 23, 2008

Network card don't work after unplug/replug

ifplugd is a Linux daemon which will automatically configure your ethernet device when a cable is plugged in and automatically unconfigure it if the cable is pulled. This is useful on laptops with onboard network adapters, since it will only configure the interface when a cable is really connected.

http://0pointer.de/lennart/projects/ifplugd

Sunday, June 24, 2007

DC++ and Linux

DC++ is a popular P2P client. Unfortunately, DC++ client for Linux has many bugs (Russian locale doesn't support for searching and etc.), limits and so not convenient as DC++ for Windows. To run DC++ (windows version) you should install WINE then install DC++ (an install package you can download from DC++ download page).

If you run DC++ through WINE and have found file then try to download it DC++ will failed. For avoiding this behavior you must turn off "Show progress bars for transfers" option in the Settings -> Advanced. Now you can use this client with pleasure.

Good luck!

Saturday, May 19, 2007

Tuning Debian Etch 4.0

During using Debian Etch I found some issues which I have described in this article.

Ugly fonts in the Iceweasel (Firefox) application

When I changed Gnome to KDE the fonts in Iceweasel became to differ from other GTK applications (e.g. GIMP, Evolution). For resolving this issue I found the following solution:

Add this string gtk-font-name="Your favorite font name and size" in the gtk config. In my case this looks like this:

File ".gtkrc-2.0.mine" included in the .gtkrc-2.0 :

gtk-font-name="Arial 8"

NTFS write support

You can found the solution for this issue on the following site. Now I use ntfs-3g module for writing on the ntfs partitions. To add support your required locale you should add the following option to mount: locale=ru_RU.utf8. The list of /etc/fstab for example:

/dev/hda2 /mnt/win ntfs-3g umask=0,locale=ru_RU.utf8 0 0

I hope ntfs-3g more or less stable :)

Debian Etch 4.0 on the Acer Aspire 1642

Quick Guide

Here's a short guide to installing Debian Etch 4.0 on the Acer Aspire 1642. Let's go!

Hardware

Part Type
Processor Intel Pentium M 1.7G
Memory 512Mb
Video card Intel 915G
Sound card Intel HDA (ALC 883 chipset)
Touchpad Synaptics Touchpad
Pair of hands Not growing from an ass

After installation of Debian Etch 4.0 I found the following issues

  • sound card is not supported by kernel 2.6.18
  • resolution 1280x800 is not supported

Sound
For resolving first issue you must change kernel to version 2.6.20+, because sound card is not supported by kernel 2.6.18. You should download kernel 2.6.20 from www.kernel.org and compile it using the following command:

# make-kpkg --append_to_version -smp --initrd kernel_image modules_image

Then you should install it:

# dpkg -i kernel_blablabla.deb

and add "model" parameter into file /etc/modprobe.d/sound:

options snd-hda-intel index=0 model=acer

and reboot linux. When you run amarok or another audio player sound will rise from the dead :)

Video

We need to install 915resolution package so open up a terminal and type:

# apt-get install 915resolution

Reboot X11 and enjoy with new resolution.

Hotkeys

To make the functionals keys work (fn+fxx, fn+up, fn+down) you should add the following code to the .bashrc or to an another place:

xmodmap -e 'keycode 160 = F16' # mute
xmodmap -e 'keycode 176 = F17' # volume up
xmodmap -e 'keycode 174 = F18' # volume down

xev utility can help you to retrieve a keycode of any key.

Useful links


Linux On Laptops