Typing spanish characters and accents in Linux

Being able to properly type and input spanish characters in text is important. If you don’t believe me, ask someone who speaks Spanish to explain the difference between año and, well, ano. Trust me, if you are trying to use año (ie, year), you don’t want to end up writing ano (ie, anus). Plus, for those hosting WordPress blogs or webpages in Spanish, if you want your pages to be properly crawled and have appropiate ads displayed, better to write with the proper characters, accents and punction.

Now, if you are working in a Linux environment like I normally do, it turns out that being able to input the necessary comments and punctionation is easily accomplished. We will use the popular “Dead keys” method. This will allow us to type an ñ by first pressing shift and tilde followed by an n. Similarly, we can type an accented charcter by first pressing followed by the charcter that we want to accent. If you want use the original functionality of the dead keys, just follow the key press with the spacebar. It doesn’t take too long to get use to.
To get started, just execute the following command


my-box:~ $  setxkbmap -layout us -variant intl

When you need to switch back, leave of the variant parameter


my-box:~ $  setxkbmap -layout us

Now, I need to say here that this will only work in when running X windows. But, I’m not trying to help you do a full blown switch to an international keyboard nor load a different keymap on the system level. This is just to help the casual user with US keyboard properly input Spanish characters, accents and punction. This could be used to write up a homework, communicate with a friend or post in another langauge with our friendly Linux box.

Así, ¿qué esperas? ¡Hazlo ya y no lo vas a arrepentir!

Howto Setup a Access Point with RaLink r61

This post is dedicated to my trials and the perils of trying to setup hostapd with a RaLInk rt2561/rt61 pci wireless network card.  It has been a long hard road, mostly because documentation is scarse.  To get an idea of what’s out there, have a look at the AP-mode “howto”.  Note the humorous comment at the beginning…”[it] is not aimed for beginners.  Hell, that howto isn’t aimed for anyone as far as I’m concerned.  So, let’s see if we can’t do a little better.

First, you’ll need to install

  • libnl-1.1 or better
  • udev-1.25 or better (I’m using 1.35, but apparently 1.25 will do)
  • hostap-0.70 or better (use git clone git://w1.fi/srv/git/hostap.git)
  • linux-2.6.29-rc6 or better

Okay, first we’ll take care of the kernel.  Make sure that the soft link /usr/src/linux points to your shiny new kernel’s source.   We also need to patch the net/mac80211/cfg.c file.   Go ahead and open this file and towards the very beginning, change…

static bool nl80211_type_check(enum nl80211_iftype type)
{
switch (type) {
case NL80211_IFTYPE_ADHOC:
case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_MONITOR:
#ifdef CONFIG_MAC80211_MESH
case NL80211_IFTYPE_MESH_POINT:
#endif
case NL80211_IFTYPE_WDS:
return true;
default:
return false;
}
}

to this…

static bool nl80211_type_check(enum nl80211_iftype type)
{
switch (type) {
case NL80211_IFTYPE_ADHOC:
case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_MONITOR:
#ifdef CONFIG_MAC80211_MESH
case NL80211_IFTYPE_MESH_POINT:
#endif
case NL80211_IFTYPE_WDS:
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_AP_VLAN:
return true;
default:
return false;
}
}

Finally, compile the kernel and the RaLink driver (Device Drivers -> Network Device Support -> Wireless Lan -> Ralink Driver Support).

Next, we’ll take care of hostapd.  Enter the hostap/hostapd directory and copy defconfig to .config.  Now, edit .config and set the driver to nl80211.  You should have CONFIG_DRIVER_NL80211=y.  Run “make” and hopefully everything compiles.  Edit hostapd.conf to your liking.  In particular, you will want to change the country code and channel to whatever is appropriate and the driver to nl80211.  I followed the steps in this nice tutorial to get WPA-PSK set working with hostapd,  At this point, you should be able to fire up hostapd with ./hostapd -d hostapd.conf and be up for business.

As I said before, I had a number of problems when trying to set this up.  Here are some pitfalls to avoid…

  • Make sure you can set the channel of your device.  The iw tool set can help out here.  Something along the lines of “iw dev wlan0 set channel 8″ should work for you.  If it doesn’t, make sure you are using a 2.6.29-rcX kernel.
  • You MUST patch the net/mac80211/cfg.c file or your device will not be able to enter into master (AP) mode.
  • iwconfig is useless as far as hostap is concerned.  You won’t be able to use it to get into master mode.  Don’t even try.  Not even once.

Of course, once you get your ap up and running, you’ll need to setup a dhcp server to handle ip address for your clients and also do some routing/forwarding for them.  Perhaps, I’ll touch on that next time.

Also, please inform us of your own success and any pitfalls you encountered and overcame.