Thursday, November 28, 2013

Installing Ralink 3090 wifi driver

I installed Kubuntu 10.10 on my new laptop, my laptop is Compaq CQ62- 308AX. It has Ralink 3090 wifi, which is not automatically detected by Kubuntu. Even restricted driver manager does not show any option for this device. So I downloaded the driver from Ralink site (http://www.ralinktech.com/support.php?s=2).  It is in the source format. I thought I might have to patch the kernel source. I went through the readme file and I found that I don’t have to compile kernel ( yippee an hr saved). Only device driver source is needed to be compile. These days things are much more simple. So I compiled the driver by running command “make” and installed it by “make install”.  It has compiled other ralink wifi modules along with 3090 module.

After installation (using ‘make install’)  reboot the machine, reboot is not necessary in Linux after installing driver.  After reboot it loaded incorrect  rt2086 module. So I tried manually unloading and loading module using insmode and rmmod commands, but it did not worked. To fix this open /etc/modprobe.d/blacklist.conf (as root) and add at the end: blacklist rt2800pci. Also open (as root) file /etc/modules and add: rt3390sta.

After rebooting the machine, wifi is working fine perfectly.

Note :- kernel version 2.6.38 and later contains the driver, so you don’t need compile it.

Here is the step by step guide to install to install Ralink wifi driver

  1. Download driver from Ralink site http://www.ralinktech.com/support.php?s=2 for your chipset.
  2. Extract it, cd to extracted folder, run make command to compile it.
  3. Run make install as root to install the module.
  4. Open /etc/modprobe.d/blacklist.conf (as root) and add at the end: blacklist rt2800pci. Also open (as root) file /etc/modules and add: rt3390sta.
  5. Reboot machine

Monday, November 25, 2013

Adding additional class to a button in drupal

Recently we were building a multi-domain site, we are using same theme for all sites but we want to have different colors for buttons for each domain. We achieved this using my overriding theme_button in template.php of theme, here is the snippet.

/**
 * Overwrite theme_button()
 * @file template.php
 */
function mytheme_button($variables) {
  $element = $variables['element'];
  // Add some extra conditions to make sure we're only adding
  // the classto the right submit button Now add our custom class
  if (isset($element['#attributes'])) {
    $element['#attributes']['class'] [] = 'button';
    $domain = domain_get_domain();
    $element['#attributes']['class'] [] = $domain['machine_name'];
  }
  $variables['element'] = $element;
  return theme_button($variables);
}