HOWTO install ASrock ION330HT remote driver on Mandriva 2010.1
#1
As a fresh owner of the ASRock ION330HT box I installed the Mandriva 2010.1 Spring on hard disk and found that built-in remote is not supported. ASRock guys offer linux driver on their web page, but unfortunately just Ubuntu distro is supported.

I hate someone driving me to use things I do not like so I decided to force the Ubuntu driver work in my Mandriva system. Experiments with the binary package failed (as expected), but the source package looked quite promising.

After some tweaking of dkms config file and makefile I ended up with the driver module working in Mandriva 2010.1 distribution (kernel 2.6.33.7, lirc 0.8.7), including sleep/resume function for XBMC.

In the next post I will describe how I did it. The HOWTO is divided into two parts - part1 deals with driver compilation, part2 with driver integration (including sleep/resume for XBMC).

I hope this HOWTO will help some people and maybe inspire someone to integrate driver into lirc package or build the RPM package for non-debian Linuxes.
Reply
#2
In the following guide, you are supposed to have installed the Mandriva 2010.1 Spring Power Pack (http://www2.mandriva.com) on ASRock ION330HT's hard disk. If considering to use XBMC media center, do not forget to install also the latest nvidia driver (http://us.download.nvidia.com/XFree86/Li...256.53.run) and XBMC (http://xbmc.org/download, or xbmc-9.11-1.svn32705.dharma.pvr_testing2.0.2mdv2010.1.rpm package from Mandriva repository).

Driver compilation

1. Make sure you have Mandriva Power Pack distro as this HOWTO fails on Mandriva One Live CD instalations !! Next check you have the following mandriva packages installed. I recommend to use urpmi or 'Install/Remove Software' GUI tool because it solves dependencies and installs also all packages these packages depend on. I can not bear out that all these packages are necessary; this is just list of packages I suppose to be necessary:

kernel-server-2.6.33.7-2mnb-1-1mnb2
kernel-server-devel-2.6.33.7-2mnb-1-1mnb2
kernel-firmware-20100217-1mnb2
kernel-firmware-extra-20100429-2mnb2
dkms-2.0.19-20mdv2010.1
lirc-0.8.7-0.20100505.1mdv2010.1
curl-7.20.1-2mdv2010.1
dkms-lirc-0.8.7-0.20100505.1mdv2010.1

2. Download the IR(10.04).zip archive from the URL http://europe.asrock.com/downloadsite/dr...10.04).zip and rename the archive to IR-10.04.zip (shell does not like parentheses in the file names). Open the IR-10.04.zip archive (double click opens it in the Archive manager); open the source package lirc-nct677x-src-1.0.4-ubuntu10.04.deb using Archive Manager (double click opens it in the new window) and extract the data.tar.gz archive (right click to DEB package, open it with Archive manager, then drag data.tar.gz icon to desktop).

3. Extract the usr/src/lirc-nct677x-src-1.0.4-ubuntu9.10 directory to the /usr/src directory (double click to data.tar.gz and then repeat double clicking to icons (., usr, src) until you see the directory name; then drag directory icon to /usr/src); finally rename the directory to lirc-nct6775-1.0.4. Check there are also linux-2.6.33.7-2mnb and lirc-0.8.7-0.20100505.1mdv2010.1 directories in the /usr/src (they should be already here).

4. Open and edit the /usr/src/lirc-nct6775-1.0.4/dkms.conf file; it should look as follows:

Code:
[font=Courier New]
PACKAGE_NAME="lirc-nct6775"
PACKAGE_VERSION="1.0.4"
CLEAN="rm -f *.*o"
MAKE[0]="make -C lirc_wb677 KSRC=$kernel_source_dir KVER=$kernelver modules"
AUTOINSTALL="yes"
BUILT_MODULE_NAME[0]="lirc_wb677"
BUILT_MODULE_LOCATION[0]="lirc_wb677"
DEST_MODULE_LOCATION[0]="/updates"
[/font]

5. Open and edit the /usr/src/lirc-nct6775-1.0.4/lirc_wb677/Makefile. Best way to edit it is replace file contents by the following:

Code:
[font=Courier New]
#!/bin/bash

KSRC ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
LIRC := $(shell ls -d /usr/src/lirc-[0-9]*)
obj-m += lirc_wb677.o
lirc_wb677-objs := lirc_wb677_main.o lirc_wb677_mouse_kbd.o

modules:
    cp -a $(LIRC)/drivers .
    grep -v "drivers/lirc.h" $(LIRC)/drivers/lirc_dev/lirc_dev.h > drivers/lirc_dev/lirc_dev.h
    mv lirc_wb677_common_extern.h TMP-file
    sed s!/usr/src/lirc-0.8.6/drivers!drivers!g TMP-file > lirc_wb677_common_extern.h
    rm TMP-file

    $(MAKE) -C $(KSRC) M=$(PWD) modules
[/font]

6. Now you can use the following dkms commands to compile and install the driver:

To add source to the dkms tree
Code:
[font=Courier New]> dkms add -m lirc-nct6775 -v 1.0.4
[/font]
To build module
Code:
[font=Courier New]> dkms build  -m lirc-nct6775 -v 1.0.4
[/font]
To install module binary
Code:
[font=Courier New]> dkms install  -m lirc-nct6775 -v 1.0.4
[/font]
Now module is loaded and device exists:

Code:
[font=Courier New]> lsmod | grep lirc
  lirc_wb677             25431  0
  lirc_dev                9334  1 lirc_wb677

> ls -l /dev/lirc/0
  crw-rw---- 1 root root 61, 0 2010-09-10 23:52 /dev/lirc/0
[/font]
The lirc_wb677.ko.gz compressed binary file resides in the /lib/modules/2.6.33.7-desktop586-1mnb/dkms/updates directory.

Now you can completely remove driver sources from the dkms tree using:
Code:
[font=Courier New]> dkms remove  -m lirc-nct6775 -v 1.0.4 --all
[/font]
Note this command deletes sources just from dkms tree (/var/lib/dkms), not from the /usr/src directory, so after you have done 'dkms remove', you can repeat the compilation process from scratch with another 'dkms add', 'dkms build', and 'dkms install' sequence.

7. Stop the lircd and check the driver is working:
Code:
[font=Courier New]
>/etc/init.d/lircd stop
> modprobe lirc_wb677
> mode2 -d/dev/lirc/0
[/font]
If you press some key on remote (OK, for example) you should get something like:

Code:
[font=Courier New]space 60000
pulse 2700
space 850
pulse 450
space 400
pulse 450
   .....
[/font]
This is timing of received mark/space sequence and confirms the driver talks with the CIR hardware.
To stop mode2, press CTRL+C.
Reply
#3
Driver integration

1. Copy the following text to the /etc/sysconfig/lircd file:

Code:
[font=Courier New]
# The hardware driver to use
DRIVER=""

# Hardware driver module to load
HWMOD="lirc_wb677"

# The CIR device node
DEVICE=/dev/lirc/0
[/font]
You can also edit the original template file - just change HWMOD="" to HWMOD="lirc_wb677"

2. Copy the following text to the /etc/lirc/lircd.conf file:

Code:
[font=Courier New]
# brand: ASRock
# model no. of remote control: TSGH-IR01
# CIR receiver: Nuvoton NCT6775F (former Winbond W83677HG-I)
# devices being controlled by this remote: ASRock ION330HT

# RC-6 config file

begin remote

   name             mceusb
   bits                 16
   flags  RC6|CONST_LENGTH
   eps                  30
   aeps                100

   header       2667   889
   one           444   444
   zero          444   444
   pre_data_bits        21
   pre_data        0x37FF0
   gap              105000
   toggle_bit           22
   rc6_mask    0x100000000

   begin codes

      Blue          0x00007ba1
      Yellow        0x00007ba2
      Green         0x00007ba3
      Red           0x00007ba4
      Teletext      0x00007ba5
      Radio         0x00007baf
      Videos        0x00007bb5
      Pictures      0x00007bb6
      RecTV         0x00007bb7
      Music         0x00007bb8
      Aspect        0x00007bd8
      Guide         0x00007bd9
      LiveTV        0x00007bda
      DVD           0x00007bdb
      Back          0x00007bdc
      OK            0x00007bdd
      Right         0x00007bde
      Left          0x00007bdf
      Down          0x00007be0
      Up            0x00007be1
      Star          0x00007be2
      Hash          0x00007be3
      Replay        0x00007be4
      Skip          0x00007be5
      Stop          0x00007be6
      Pause         0x00007be7
      Record        0x00007be8
      Play          0x00007be9
      Rewind        0x00007bea
      Forward       0x00007beb
      ChanDown      0x00007bec
      ChanUp        0x00007bed
      VolDown       0x00007bee
      VolUp         0x00007bef
      More          0x00007bf0
      Mute          0x00007bf1
      Home          0x00007bf2
      Power         0x00007bf3
      Enter         0x00007bf4
      Clear         0x00007bf5
      Nine          0x00007bf6
      Eight         0x00007bf7
      Seven         0x00007bf8
      Six           0x00007bf9
      Five          0x00007bfa
      Four          0x00007bfb
      Three         0x00007bfc
      Two           0x00007bfd
      One           0x00007bfe
      Zero          0x00007bff

   end codes
end remote
[/font]

3. To start driver on boot, add following commands into the /etc/rc.d/rc.local file:

Code:
[font=Courier New]
modprobe  lirc_wb677                       # load remote driver
/etc/init.d/lircd restart                  # start lirc service again
[/font]
4. Reboot and check the remote is working:

Code:
[font=Courier New]
> irw
  000000037ff07bdd 00 OK mceusb        <-- remote button OK pressed >
  000000037ff07ba5 00 Teletext mceusb  <-- remote button Teletext pressed >
  .....
[/font]
You should see the key code and name of each button you press.
To stop irw, press CTRL+C

Suspend/resume for XBMC

5. Create new file 99lirc-resume.sh in the /etc/pm/sleep.d directory, containing:

Code:
[font=Courier New]
#!/bin/sh
# This script will restart lirc drivers, Lirc, and XBMC's lirc interpreter upon resume.
# This script uses curl. Make sure you have the curl package installed.

case "$1" in  
   resume)
      curl "http://127.0.0.1:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=LIRC.Stop"
      rmmod lirc_wb677
      modprobe lirc_wb677               # load remote driver
      /etc/init.d/lirc restart          # restart lirc service

      # uncomment the next line if your computer goes to sleep immediately after resume
      # irw & sleep 1; killall irw

      curl "http://127.0.0.1:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=LIRC.Start"
      echo "lirc resume script completed" >> /var/log/resume.log
   ;;
esac
[/font]

6. Add the following lines to /etc/rc.d/rc.local just below the lines you added in the step 3 above:

Code:
[font=Courier New]
echo CIR > /proc/acpi/wakeup             # enable wakeup from remote
echo USB0 > /proc/acpi/wakeup            # enable wakeup from keyboard
echo "rc.local completed" >> /var/log/resume.log
[/font]
so you should see something like this:
Code:
[font=Courier New]
modprobe lirc_wb677                      # load remote driver
/etc/init.d/lircd restart                # start lirc service again
echo CIR > /proc/acpi/wakeup             # remote wakeup enable
echo USB0 > /proc/acpi/wakeup            # keyboard wakeup enable
echo "rc.local completed" >> /var/log/resume.log
[/font]
7. Reboot and check /proc/acpi/wakeup has changed:

Code:
[font=Courier New]
> cat /proc/acpi/wakeup
  Device  S-state  Status    Sysfs node
  CIR     S4       enabled   pnp:00:04
  SMB0    S4       disabled  pci:0000:00:03.2
  USB0    S4       enabled   pci:0000:00:04.0
  USB2    S4       disabled  pci:0000:00:04.1
  NMAC    S5       disabled  pci:0000:00:0a.0
  PBB0    S4       disabled  pci:0000:00:09.0
  HDAC    S4       disabled  pci:0000:00:08.0
  XVR0    S4       disabled  
  XVR1    S4       disabled  
  P0P5    S4       disabled  
  P0P6    S4       disabled  pci:0000:00:15.0
  P0P7    S4       disabled  
  P0P8    S4       disabled  
  P0P9    S4       disabled  
[/font]
Note the status in CIR and USB0 lines changed to 'enabled'.

An this is all, folks!

After this is done and XBMC package is installed, you should be able to control XBMC media center using ASRock 330HT native remote, including sleep/resume function. To get sleep/resume function working, proper XBMC configuration is also necessary:

- in System --> Network --> Services set 'Allow control of XBMC via HTTP' to ON,
- in System --> System --> Power saving set 'Shutdown function' to Suspend.

No idea if remote works also in other applications - do not ask me, try instead!
.... and drop the note here if you succeed Wink
Reply

Logout Mark Read Team Forum Stats Members Help
HOWTO install ASrock ION330HT remote driver on Mandriva 2010.10