# Aureal ATWF@83 ESKY

## Hardware

This device is a cheap remote control that can be bought on the web for a few dollars. It is recognized as both a keyboard and a mouse. However not all keys work out of the box as they are combinations of several keyboard keys. This driver should work completely with kernel 2.6.34 and newer. Some keys may not work with older versions of kernel.

## Configuration

### Udev

This rule creates links for the keyboard and the mouse parts in /dev/lirc. Create a file "lirc_atwf83.rules" in /etc/udev/rules/ that contains the following lines :

      # Rules for "ATWF@83-W001_ESKY.CC_USB_V3B" USB remote to be managed by lirc
      ATTR{idVendor}!="0755", GOTO="atwf83_end"
      ATTR{idProduct}!="2626", GOTO="atwf83_end"
      KERNEL!="hidraw[0-9]*", GOTO="atwf83_end"

      # Link raw devices into "/dev/input/ir"
      ATTRS{bInterfaceNumber}=="01", SYMLINK+="lirc/atwf83_mouse"
      ATTRS{bInterfaceNumber}=="00", SYMLINK+="lirc/atwf83_kbd"

      LABEL="atwf83_end"

### Xorg

Since multimedia keys of the remote work out of the box in xorg, pressing them may trigger the default actions associated with these keys and the lirc action at the same time. The following rule forces xorg to ignore the remote. Create a file in /etc/X11 xorg.conf.d and name it 70-atwf83.conf.

      # Make xorg ignore the remote to disable multimedia keys
      # default actions.
      # !!! This prevents the mouse part of the remote from
      # working too !!!
      Section "InputClass"
        Identifier "Ignore ATWF@83 remote input"
        MatchProduct "ESKY.CC USB_V3B"
        Option      "Ignore" "on"
      EndSection

### Starting lirc

Since not all keys belong to a single device, lirc has to be run twice. The following script launches lirc for the mouse and the keyboard parts using symlinks created by the udev rule. It creates the lirc device /dev/lircd that will be used by lirc client applications. This script can be placed in /etc/init.d so that lirc will be run on startup.

      #! /bin/sh

      lircd_BIN=/usr/sbin/lircd
      test -x $lircd_BIN || exit 5

      lircd_CONF=/etc/lirc/lircd.conf
      lircd_PID=/var/run/lirc/lircd.pid
      lircd_PID1=/var/run/lirc/lircd1.pid

      case "$1" in
          start)
              echo -n "Starting lircd "

              if [ ! -L /dev/lircd ]; then
                rm -f /dev/lircd
                ln -s /var/run/lirc/lircd /dev/lircd
              fi

              lircd_ARGS="--device=/dev/lirc/atwf83_kbd --pidfile=$lircd_PID --driver=atwf83 --output=/var/run/lirc/lircd --connect=localhost:8765"
              lircd_ARGS1="--device=/dev/lirc/atwf83_mouse --pidfile=$lircd_PID1 --driver=atwf83 --output=/var/run/lirc/lircd1 --listen"

              $lircd_BIN ${lircd_ARGS1[@]}
              $lircd_BIN ${lircd_ARGS[@]}
              ;;
          stop)
              echo -n "Shutting down lircd "
              killproc -TERM -p $lircd_PID $lircd_BIN
              killproc -TERM -p $lircd_PID1 $lircd_BIN
              ;;
          restart)
              $0 stop
              $0 start
              ;;
          *)
          echo "Usage: $0 {start|stop|restart}"
              exit 1
              ;;
      esac

## Troubleshooting

- Some keys don't work
  - Check that your kernel is 2.6.34 or newer.
  - Maybe your remote is in "mouse mode". Press the "Toggle mouse" button and try again.