Sunday, August 19, 2012

How to get the usb wifi/wireless adapter "Logitech LAN-W150N" working in linux...

The Logitech LAN-W150N is an ugly yet very cheap wifi adapter sold very widely in Japan...

Here's a picture:


To get it working, you'll have to get the firmware (you can also compile it yourself, as it's open source), and recompile the linux kernel to detect it properly.

In this example I'll be using Debian (squeeze).

1. Get the linux kernel's source.
sudo apt-get install linux-source-2.6.32
2. In the kernel source, add the line with "rikijpn" to the following file:
$LINUX_SOURCE_DIR/drivers/staging/rt2860/usb_main_dev.c
{USB_DEVICE(0x0789, 0x0162)},   /* Logitec 2870 */
{USB_DEVICE(0x0789, 0x0163)},   /* Logitec 2870 */
{USB_DEVICE(0x0789, 0x0164)},   /* Logitec 2870 */
{USB_DEVICE(0x0789, 0x0168)},   /* Logitec 2870 -> rikijpn */
{USB_DEVICE(0x177f, 0x0302)},   /* lsusb */
{USB_DEVICE(0x0B05, 0x1731)},   /* Asus */
{USB_DEVICE(0x0B05, 0x1732)},   /* Asus */
{USB_DEVICE(0x0B05, 0x1742)},   /* Asus */
{USB_DEVICE(0x0DF6, 0x0017)},   /* Sitecom */

3. Compile and install the kernel (as a debian package would be great, meaning portable)
Instructions to do this in this good looking guy's (my) page : http://www.rikijpn.co.cc/en/make_kernel.php

4. Install the firmware
  1. sudo apt-get install firmware-ralink
  2. And/or get the sources for the firmware (http://www.ralinktech.com/en/04_support/support.php?sn=501, get the RT2870USB(RT2870/RT2770) drivers), and changing the variables in the following files:

    in Makefile (change as proper):
    LINUX_SRC = /usr/src/linux-source-2.6.26
    LINUX_SRC_MODULE = /lib/modules/2.6.26.custom+for+fujitsu/kernel/drivers/net/wireless/
    
    and in os/linux/config.mk:
    HAS_WPA_SUPPLICANT=y
    

    then make the usual ./configure && make && sudo make install
5. Edit your network interfaces file.
In /etc/network/interfaces, add something like:
auto wlan0
iface wlan0 inet dhcp
  wpa-ssid SSID_NAME 
  wpa-psk SSID_PASSWORD
6. Install the package "iw", for managing wireless devices.

Voila! Boot your computer the newly compiled kernel, and you'll see you'll now have a /dev/wlan0 device.
Check with the commands "iwconfig", and "iwlist wlan0 scanning" or plug out and back in the usb device and check it's detected OK in dmesg.

References

Wednesday, April 25, 2012

capoeira classes

After having done some Japanese martial arts and mountain biking as my main physical activities (the ones that don't include my girlfriend...). I never imagined I'd be doing capoeira. Especially in Japan^^.
But it's great.
I spent one year without any physical activity, I spend all day long from like 09:30 to 20:00 in front of a computer, doing a job I enjoy very much, but that makes me fat.

But since I started doing capoeira ---as I was interested in martial arts, especially if it didn't cost me much... ------ All the muscle mass I lost last year is coming back to me! I actually think I even have more! And I feel I can kick ass, which is even better...

So, what is capoeira?
It's something that let's you move like in this video (ignore the gay music and crappy roads...):



Or in a more romantic way:
Dirty Dancing 3: Capoeira Nights with Camilla Belle & Jesse Williams

Or in a more realistic, ass kicking way:


and from the movie only the strong:

I think you got the idea...

Anyway, it's absolutely great; fun, cheap (compared to karate and most martial arts I know...), and can be as physically challenging as your body wants it to be. And it's kind of popular with girls too! At least in Japan, it is... I'm so looking forward doing it with my girlfriend... (I mean, capoeira of course...).




capoeira classes near yokohama

These are some capoeira classes around the Yokohama area.
Please also check out these links if you are interested:

  1. cordao de contas yokohama area
  2. another cordao de contas link
(I'm only putting capoeira regional links, as when I went to check out the angola class it wasn't very fun... and it was long as hell... -> near Shinagawa, and the teacher of the cordao de contas thing is so damn polite!^^)


The address and details are in Japanese... please use google translate if necessary^^.

Bashamichi class

--馬車道クラス--
毎週木曜日
時間:19:00~20:45
場所:batubatu b + studio
神奈川県横浜市中区南仲通4-55 国際馬車道ビル地下1階
料金:体験レッスン・1レッスン=2000円 4レッスン=7500円
馬車道クラスは、入会金はありません。
just get down on bashamichi station, exit by exit number 5, walk straight, and it'll be like the 3th building in the left side... follow the mighty google maps...




Higashi-hakuraku class

---東白楽クラス---
毎週日曜日
時間:11:00~13:00
場所:スタジオコスモス
神奈川県神奈川区西神奈川3-2-11カヤギヤビル3F
料金:1レッスン=2000円 4レッスン=7500円 6レッスン=11000円など
東白楽クラスは入会金があり、一年に一度帯の昇段式があります。
You can go from either Higashihakuraku station, or Higashi-kanagawa station (about 12mins walking).


View Larger Map


Other

Some other related classes (please check the link on the top...):
金曜:日吉 20:30~22:30
土曜:藤沢本町 12:00~14:00
土曜:日吉 19:30~21:30
日曜:東白楽 11:00~13:00
日曜:藤沢 17:00~19:00

Tuesday, April 3, 2012

emacs23's C-n next-line annoys me...

Who guessed one of the most used functions would change like this...
Before emacs23 we used C-p and C-n to move to the previous and next lines respectively. Being the next line, the line before the "\n" character, and about the same amount of characters from the previous "\n" (the same or last column).
Now, it's visually oriented, so C-n just means whatever is below the current cursor's position... As you can guess, this is very annoying if you've used emacs for a while.
From this page, I checked this can be fixed by setting the line-move-visual variable to nil.

fix this

  1. input "line-move-visual" on any buffer in emacs23
  2. press C-h C-v RET after it
  3. press C-o, move the cursor till "customize", and RET
  4. move the cursor to "Toggle" and set it to "off"
  5. RET on "Save for future sessions"
Yay, I have my old C-n and C-p back... there's stuff that just isn't supposed to be changed I guess...

american football and baseball

The only sport I used to like was American football.


But now, thanks to the place I'm working, I also started liking Japanese baseball...


 except for that crappy music though...


Sunday, March 18, 2012

import your google contacts to bbdb

I'm a gnus user, but I have an android cellphone...

Here's a quick and dirty way to import your google contacts list to bbdb (only name and e-mail addresses).


  1. A. Get googlecl ("sudo apt-get install googlecl" in debian).
    Remember to change the default settings in ~/.googlecl/config for [Contacts]'s list_style to:
    list_style = name,email
    
    and do
    google contacts list >some_temp_file.txt
    B. Or export your contacts to CSV in google contacts (more -> export), and leave only the Name and e-mail address fields
  2. in emacs, open ~/.bbdb
  3. Press M-> to go the end of the file, and C-u M-! to insert the output of a command
  4. Run the script below like this:
  5. google_contacts_to_bbdb.sh some_temp_file.txt
  6. check your contacts are in there, and restart emacs or reload bbdb
  7. Test C-m to write an e-mail and write someone's name or e-mail address, press TAB for the next e-mail address of the same person

Source for google_contacts_to_bbdb.sh:
#!/bin/bash

FILE=$1
DATE=`date +%Y-%m-%d`

awk -F','  '{
  name=$1;
  split($2,emails_dirty," ");

  newline_counter=0;
  newline[newline_counter++] = $1;
  for (field in emails_dirty){
      match(emails_dirty[field],/[^ ]*@[^ ;]*/,clean_email);

      if (clean_email[0] != "") {
   newline[newline_counter++] = clean_email[0];
      }
  }

  if (newline[1] != "") {

      #A outputs name in bbdb format
      printf "[\"%s\" ", newline[0]; 
      printf " nil nil nil nil nil (";

      #B printing name for csv output 
#      printf "%s, ", newline[0];

      for (i=1; i< length(newline); i++) { #list of e-mails
   # A to output email addresses quoted
   if (i != (length(newline) -1 )){
       printf "\"%s\" " , newline[i]; 
   }
   else{
       printf "\"%s\"" , newline[i]; 
   }
   # B to output emails pretty
#   printf "%s " , newline[i];
      }
      
      # A for closing part in line for bbdb fields
      printf ") ((creation-date . \"'$DATE'\") (timestamp . \"'$DATE'\")) nil]";
      printf "\n";
  }
  delete newline;
}' $FILE

#sample output
#["my-name3" nil nil nil nil nil ("my3@email.com") ((creation-date . "2012-03-17") (timestamp . "2012-03-17")) nil]

Tuesday, January 24, 2012

simple ftp server

Lately vsftpd is growing in popularity.
But I installed ftpd as I didn't know vsftpd and works fine anyway.

Install (debian):
sudo apt-get install ftpd


You can deny access by:
  1. editing /etc/hosts.allow, hosts.deny
  2. editing /etc/ftpusers
  3. editing /etc/services
One thing I always forget is to do
/etc/init.d/openbsd-inetd restart
After updating /etc/services...

That's about it for the basics. Give it a try to copy stuffs from other servers or your cellphone (connect it to the same network with wifi), it's the fastest thing you can use.