if you cant sleep

10 May 2013programmingstar

try this in your terminal :)

perl -MCurses -e'$x=150;@r=map{[rand($x),rand(5),rand(25)]}(0..25+rand(200));$s = new Curses;do{$s->clear;$s->addch($_->[2],$_->[0],".")foreach@r=map{[($_->[0]<$_->[1])?$x:$_->[0]-$_->[1],$_->[1],$_->[2]]}@r;$s->refresh;}while(select(undef,undef,undef,0.15)||1);'

also make sure you have Curses.pm installed :)

sensonic cordless optical mouse MX200 Linux driver

2 December 2012tips & trickshidkernellinuxmodulesusbwireless

wireless mouse is great when you want to be 3-5 feet away from your pc and still want to have control over it. so i bought this sensonic cordless optical mouse MX200 and I'm being using it extensively to play DOTA.

It was great in windows but not working so well in Linux. lsusb output show the mouse keep connected and disconnected randomly, render it to be unusable.

$ lsusb output
Bus 006 Device 002: ID 0603:1602 Novatek Microelectronics Corp.

to fix this we need to add device id and its vendor id to hid module, below is the patch (kernel 3.6.6)

Index: linux-stable/drivers/hid/hid-ids.h
--- linux-stable.orig/drivers/hid/hid-ids.h
+++ linux-stable/drivers/hid/hid-ids.h
@@ -830,4 +830,7 @@
 #define USB_VENDOR_ID_PRIMAX 0x0461

+#define USB_VENDOR_ID_NOVATEK 0x0603
Index: linux-stable/drivers/hid/usbhid/hid-quirks.c
--- linux-stable.orig/drivers/hid/usbhid/hid-quirks.c
+++ linux-stable/drivers/hid/usbhid/hid-quirks.c
@@ -96,6 +96,7 @@ static const struct hid_blacklist {



to recompile the kernel for ubuntu, please follow my previous kernel compilation guide

how to compile kernel with RT patch

16 November 2012tips & trickscompilekernellinuxrealtime

we will be working here

cd /usr/src/

download all required files

axel -a http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.6.6.tar.bz2
tar xjvf linux-3.6.6.tar.bz2 && cd linux-3.6.6/
axel -a http://www.kernel.org/pub/linux/kernel/projects/rt/3.6/patch-3.6.6-rt17.patch.bz2

test the RT patch before actually patch it ( make sure you are now in /usr/src/linux-3.6.6/ )

bzcat patch-3.6.6-rt17.patch.bz2|patch -p1 --dry-run

if everything seem ok, lets really patch it

bzcat patch-3.6.6-rt17.patch.bz2|patch -p1

remove the -rt17 prefix local kernel version. this seem to cause problem when running make-kpkg later

echo > localversion-rt

copy current kernel configuration

make clean && make mrproper && cp /boot/config-$(uname -r) ./.config

configure our kernel

make menuconfig

below is the setting that use, please find the menu by browsing the menu config console
note: please choose processor family accordingly

Processor Type and Features
[ ] Enable MPS table
Processor family (Core 2/newer Xeon) -->
[ ] IBM Calgary IOMMU support
Preemption Model (Fully Preemptible Kernel (RT)) -->
Timer frequency (1000 HZ) -->
[ ] kernel crash dumps

Kernel Hacking
[ ] Enable unused/obsolete exported symbols
[ ] Kernel debugging
[ ] Compile the kernel with frame pointers
RCU Implementation (Preemptible tree-based hierarchical RCU) -->

below is the setting to enable general support for (most) webcams

Device Drivers -->
[*] Multimedia Support -->
[*] Cameras/video grabbers support
[*] Video capture adapters (NEW) -->
[*] V4L USB devices -->
<M> USB Video Class (UVC)

[ ] = untick
[*] = tick

[optional] this is gcc option tuned for my machine and i'm using Intel(R) Core(TM)2 Duo CPU E4500, yours may differ

export CFLAGS="-O2 -pipe -march=native --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=2048 -mtune=native -mfpmath=sse -m64";

lets compile our kernel and build the .deb package (you may choose your own append_to_version= )

CONCURRENCY_LEVEL=$(getconf _NPROCESSORS_ONLN) fakeroot make-kpkg --initrd --append_to_version=-zxr --revision=0 kernel_image kernel_headers

cd ..
dpkg -i linux-*3.6.6*.deb

reboot to and select your new kernel. check your kernel and you should see something like below

└──╼ uname -a
Linux ZX10R 3.6.6-zxr #1 SMP PREEMPT RT Fri Nov 16 01:45:28 MYT 2012 x86_64 GNU/Linux

that's it... kernel compilation is not a rocket science after all isn't?
have fun with your blazing fast responsive desktop ~

foot notes:

  1. this guide can use to compile normal kernel without RT patch
  2. if you would like recompile the kernel after enabling some modules in menuconfig, below is how make make-kpkg faster
    export CLEAN_SOURCE=no
    CONCURRENCY_LEVEL=$(getconf _NPROCESSORS_ONLN) fakeroot make-kpkg --initrd --append_to_version=-zxr --revision=0 kernel_image kernel_headers

Download required linux driver (RT8070 /RT3070 /RT3370 /RT5370 /RT5372 USB) from ralinktech web page

install required files to build this

sudo apt-get install build-essential linux-headers-$(uname -r)

extract the source

tar xjvf 2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO.bz2 && cd 2011_0719_RT3070*

inline edit /os/linux/config.mk to enable WPA support (i'm too lazy to fire vim)

perl -i -pe 's/^(HAS_WPA_SUPPLICANT|HAS_NATIVE_WPA_SUPPLICANT_SUPPORT)=(n)$/\1=y/g' os/linux/config.mk

lets verify that we correctly replace the string (shrug!)


compile & install

sudo make && sudo make install

add module to the kernel

sudo modprobe rt5370sta

check if your network card

ifconfig -a;iwconfig

You should see something like below..

ra0 Link encap:Ethernet HWaddr f8:d1:11:09:cf:87


RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:136644 (136.6 KB) TX bytes:22019 (22.0 KB)


ra0 Ralink STA ESSID:"11n-AP" Nickname:"RT2870STA"

Mode:Auto Frequency=2.412 GHz Access Point: Not-Associated

Bit Rate:1 Mb/s

RTS thr:off Fragment thr:off

Link Quality=10/100 Signal level:0 dBm Noise level:0 dBm

Tx excessive retries:0 Invalid misc:0 Missed beacon:0

that's it...easy right?

troubleshooting: if you wifi still not working after step g, try to unplug and plug back your adapter

penyokong yang bijak

8 July 2012writingsobsestaksub

jangan menyokong dengan pujian dan sanjungan semata mata

tapi sokonglah dengan pertanyaan, persoalan serta penjelasan

jadilah manusia yang bijak