Difference between revisions of "NeTV IR driver"

From Studio Kousagi Wiki
Jump to: navigation, search
Line 7: Line 7:
 
These steps instruct you on how to load a new kernel onto your device.  Any time you modify the kernel, you risk making your system unbootable. '''Do not continue unless you are familiar with how to re-image your SD card.'''
 
These steps instruct you on how to load a new kernel onto your device.  Any time you modify the kernel, you risk making your system unbootable. '''Do not continue unless you are familiar with how to re-image your SD card.'''
  
 +
==Setting up your build environment==
 +
These steps will set up an environment that will allow you to modify the IR kernel drivers.  These steps only need to be completed once.
 
# Install and configure the [[NeTV toolchain]]
 
# Install and configure the [[NeTV toolchain]]
 +
# Enable SSH on your NeTV
 
# Check out the kernel
 
# Check out the kernel
 
#* git clone git://github.com/sutajiokousagi/linux-2.6.28-silvermoon.git; cd linux-2.6.28-silvermoon/src/; git checkout netv
 
#* git clone git://github.com/sutajiokousagi/linux-2.6.28-silvermoon.git; cd linux-2.6.28-silvermoon/src/; git checkout netv
Line 16: Line 19:
 
#* Go to Device Drivers ---> Input Device Support ---> CIR device and set it from <*> to <M>
 
#* Go to Device Drivers ---> Input Device Support ---> CIR device and set it from <*> to <M>
 
#* Select < Exit > repeatedly, answer < Yes > when it asks you to save your new kernel configuration
 
#* Select < Exit > repeatedly, answer < Yes > when it asks you to save your new kernel configuration
 +
# Enable DEBUG mode in the GPIO IR driver
 +
#* nano -w drivers/input/gpio_ir.c
 +
#* Add the following to the very top of the file:
 +
#** #define DEBUG
 +
#* Save and quit:
 +
#** Control-X, Y, Enter
 
# Build a new kernel
 
# Build a new kernel
 
#* make
 
#* make
Line 24: Line 33:
 
# On your NeTV, reboot into the new kernel
 
# On your NeTV, reboot into the new kernel
 
#* reboot
 
#* reboot
 +
 +
==Modifying the GPIO IR driver==
 +
Every time you make changes to the GPIO driver, you must rebuild the module, copy the kernel object over, and reload it.  You do not need to reboot your NeTV unless there is a problem with resource management, or if there is a crash in the driver.
 +
# Make changes to drivers/input/gpio_ir.c
 +
# Rebuild kernel modules
 +
#* make modules
 +
# Copy gpio_ir.ko to your NeTV
 +
#* scp drivers/input/gpio_ir.ko root@[NeTV-address]:
 +
# On your NeTV, make sure the GPIO IR driver is not installed
 +
#* rmmod gpio_ir
 +
# On your NeTV, install the newly-copied GPIO IR driver
 +
#* insmod gpio_ir.ko

Revision as of 08:45, 16 April 2012

NeTV uses a GPIO-based IR sensor. That means that it's simply counting the pattern of 0s and 1s coming from a sensor that performs IR detection and demodulation.

There is currently no LIRC driver. Instead, it acts as a keyboard driver, using a hard-coded set of scancodes and key equivalents. By modifying the driver, it's possible to add new keys or to change the mapping.

Note that it might be useful to build the kernel as a module. That way you can try new code without having to reboot.

These steps instruct you on how to load a new kernel onto your device. Any time you modify the kernel, you risk making your system unbootable. Do not continue unless you are familiar with how to re-image your SD card.

Setting up your build environment

These steps will set up an environment that will allow you to modify the IR kernel drivers. These steps only need to be completed once.

  1. Install and configure the NeTV toolchain
  2. Enable SSH on your NeTV
  3. Check out the kernel
  4. Grab the latest config file
  5. Convert the IR driver from a builtin to a module
    • make menuconfig
    • Go to Device Drivers ---> Input Device Support ---> CIR device and set it from <*> to <M>
    • Select < Exit > repeatedly, answer < Yes > when it asks you to save your new kernel configuration
  6. Enable DEBUG mode in the GPIO IR driver
    • nano -w drivers/input/gpio_ir.c
    • Add the following to the very top of the file:
      • #define DEBUG
    • Save and quit:
      • Control-X, Y, Enter
  7. Build a new kernel
    • make
  8. Copy the kernel to your NeTV
    • scp arch/arm/boot/zImage root@[NeTV-address]:
  9. On your NeTV, write the new kernel
    • config_util --cmd=putblock --block=krnA < zImage
  10. On your NeTV, reboot into the new kernel
    • reboot

Modifying the GPIO IR driver

Every time you make changes to the GPIO driver, you must rebuild the module, copy the kernel object over, and reload it. You do not need to reboot your NeTV unless there is a problem with resource management, or if there is a crash in the driver.

  1. Make changes to drivers/input/gpio_ir.c
  2. Rebuild kernel modules
    • make modules
  3. Copy gpio_ir.ko to your NeTV
    • scp drivers/input/gpio_ir.ko root@[NeTV-address]:
  4. On your NeTV, make sure the GPIO IR driver is not installed
    • rmmod gpio_ir
  5. On your NeTV, install the newly-copied GPIO IR driver
    • insmod gpio_ir.ko