Wednesday, June 17, 2009

I hate touchpad


Tonight i reinstall my old Thinkpad T30, i use Fedora 8. I except Fedora 8's Linux kernel has support with it's wlan card Atheros Communications, Inc. AR5212 802.11abg NIC as listed on ifcfg-wlan0 network script, now the kernel has detected it correctly with module named ath5k.

My problem is it's touchpad, synaptic was responsible for this. After do googling a while, i got this soulution:

- Set "SHMConfig" option to be "on" in the X configuration file ("InputDevice" section)

Section "InputDevice"
   Identifier  "Synaptics"
   Driver  "synaptics"
   Option  "Device" "/dev/input/mice"
   Option  "Protocol" "auto-dev"
   Option  "Emulate3Buttons" "yes"
   Option  "SHMConfig" "on"
EndSection


- Use synclient to modify the touchpad. See synclient -l

- Then a variable named TouchpadOff will be disable the touchpad, set the variable value
$synclient TouchpadOff=1 (0 to re-enable)

Now the touchpad should not bothering me ;p.

Friday, June 05, 2009

In Kendari

This is a late post, because i was too lazy to update my blog. This post describe about my visit in Kendari

Cingkareng 06-05-2009, 10:00am
I arrived from Rawamangun bus shelter, Dwi accompany me with his motorcycle. I got airport bus service that directly transport me to the Airport. I got Lion Air one-way tickets (in the previous post), they only allow me in Kendari for 2 days ;p. My flight has been scheduled at 12.30am, so i wait. I think im cool enough, i got black long-shirt with red sign in left arm (inspired by Arch Anarchy's guitarists). Black metal guitarist ;p.

12.30pm
The airplane has been scheduled for 30 minutes delay due the bad weather, and after waiting... at last the plane arrived. Shit, this maybe a got 'trauma'... im so fucked when the airplane got turbulence due the bad weather, dark cloud, rain and winds. I keep praying..., thanks for the woman (who i helped to bring her baggage) thanks for Tango wafer.

4.30pm
At last... im in Kendari, the rock city. Fandy my second brother call for me with his motorcycle too. Arrived at home, see my parents and sister and the other families. Not too long, Romy comes then Aswar, Rizal. Doing talk session as friends who never meet for a long time.

Finally im home, with my beloved peoples and friends... it's nice to be here...

Going home...

I'm going home today, i got time at Fri 5 through 8 June, that sucks, i never going to home for only 2 days. The cool thing is my company accommodated my plane's cost for departure and return. I'm going to meet my family and friends again that i have been missed for long time, and for the special event is 'Rizal's marriage'. I call Ferda yesterday, she got cold, nice to talk with you girl.

Monday, June 01, 2009

ETHTOOL: socket-level I/O control calls



The TCT machine that we developed should has network capability, this used for acquiring and retrieving data from the database server (PostgreSQL server). I made a low level utility today, share the memory through POSIX shared memory in order to be read by the TCT machine, the purposes of this utlity is to provide network status such as plugged/unplugged network cable, unreached server and notify if the database server is running or not.

The socket-level I/O control call that kernel provide using ioctl system call require root permission. So i create this as another process (like the daemon) and shared it's status memory area, to know the server connection i simply forking ping utility, pass some options to pinging the server. At last, to probe the database service running state i just connect to the database server via it's running port.

And this is the core codes, i'm pointing to the kernel's socket-level I/O control calls, and call them in userspace (kernel-2.6.27):

#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
#include <linux/ethtool.h>
#include <linux/sockios.h>

int main (void)
{
int s, ret;
struct ethtool_value edata;
struct ifreq ifr;

s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (s == -1)
{
perror ("socket");
return -1;
}
edata.cmd = ETHTOOL_GLINK;
strncpy (ifr.ifr_name, "eth0", sizeof(ifr.ifr_name) - 1);
ifr.ifr_data = (char *) &edata;

ret = ioctl (s, SIOCETHTOOL, &ifr);
if (ret == -1)
{
perror ("ioctl");
return -1;
}
printf ("link is %s\n", edata.data ? "up" : "down");
close (s);

return 0;
}