View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 37 posts ] 
Go to page 1, 2, 3  Next

Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Thu Apr 05, 2007 5:12 am 
MCE Keyboard Instillation on R5E50

I am looking for guidance with installing a Microsoft MCE 2005 keyboard driver using the Microsoft USB IR receiver. Guidance is the word you use when you know little and are dangerous. The authors websites for driver information are here.
The MCE keyboard is composed of two different systems. The RC6 keyboard Media Keys which are a match (almost) to the keys on the MCE RC6 remote. The RC5 section has the USB keyboard with integrated mouse. The keyboards Media buttons mimic the version 2 MCE remote and already work in R5E50. Due to the fact that Knoppmyth has a working RC6 lirc section I am only looking at installing the mod_mce driver for the keyboard RC5 section (unless failure changes the plan and we have to use the lirc_mod_mce driver).

The only install information that the author provides is this statement.
Quote:
mod_mce
Since some new input functions are used in this project, please update your kernel. You have to enable USB and input in your kernel configuration. Building is done by executing 'make'.

The kernel requirement is 2.6.10 or higher so we should be in good shape there and the USB IR receiver is already recognized by lirc but I don't know where that puts us with the USB keyboard section. The USB sharing may be the reason for the lirc_mod_mce driver. I guess we will just have to find out. That leaves the statement building is done by executing ‘make’? The code for the three files in the folder are the bottom 90%of this post.
    :?: 1. Is it as easy as copying the mod_mce folder to the machine and executing the install.sh script. The statement by the author "Building is done by executing 'make' " statement throws me off here. If so where is the correct location to place it in the file system. What is the correct way to install this driver, can you give me a procedure?

    :?: 2. When I look at the code in the install.sh and Makefile files I see no reference to the driver file mod_mce.c file in ether one. I see mod_mce.ko and mod_mce.o . How is the mod_mce.c file called. The real question I am asking, is this code correct
I have a hard drive that I can load up a clean version of R5E50 on for testing purposes. If there is any more information that would be helpful let me know and I will go on a quest.
If you don't make it to the bottom of this page.
    Thank You for your Expertize
    TVBox
The mod_mce folder contains four files. COPYING, install.sh, Makefile, and mod_mce.c The contents of each of these files are listed below.

COPYING
Code:
GNU General Public License information

install.sh
Code:
#!/bin/sh
install -m 644 mod_mce.ko /lib/modules/`uname -r`/kernel/drivers/mod_mce.ko
/sbin/depmod -a

Makefile
Code:
obj-m := mod_mce.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

default:
   $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

mod_mce.c
Code:
/*
 * Input driver for Microsoft MCE 2005 keyboard
 *
 * (C) by Florian Demski
 *
 * Based upon lirc_mcesub2.c from Martin A. Blatter
 *
 **********************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 */

#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10)
   #error "This modules needs kernel 2.6.10 or higher"
#endif

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
   #include <linux/compat.h>
#else
   #include <linux/config.h>
#endif
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/kmod.h>
#include <linux/smp_lock.h>
#include <linux/completion.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
#include <linux/poll.h>
#include <linux/wait.h>
#include <linux/input.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
   #include <linux/usb/input.h>
#else
   #include <linux/usb_input.h>
#endif

#define DRIVER_VERSION      "0.1.3"
#define DRIVER_AUTHOR        "Florian Demski"
#define DRIVER_DESC          "Input driver for Microsoft MCE 2005 keyboard"
---------- Snip ------------------ Partial File ------------------

    Thank You for your Expertize
    TVBox


Last edited by TVBox on Thu Apr 12, 2007 12:48 pm, edited 3 times in total.


Top
  
 
PostPosted: Thu Apr 05, 2007 6:54 am 
Offline
Joined: Tue May 16, 2006 8:41 am
Posts: 47
Location: United Kingdom
TVBox wrote:
    :?: 1. Is it as easy as copying the mod_mce folder to the machine and executing the install.sh script. The statement by the author "Building is done by executing 'make' " statement throws me off here. If so where is the correct location to place it in the file system. What is the correct way to install this driver, can you give me a procedure?

    :?: 2. When I look at the code in the install.sh and Makefile files I see no reference to the driver file mod_mce.c file in ether one. I see mod_mce.ko and mod_mce.o . How is the mod_mce.c file called. The real question I am asking, is this code correct


install.sh appears to exist purely to copy the compiled driver to the correct directory - it does NOT compile the driver in the first place (it doesn't exist with lirc_mod_mce).

The process I've used to download & compile the driver is as follows

Code:
# cd /tmp/
# wget http://kent.dl.sourceforge.net/sourceforge/mod-mce/mod_mce-0.1.3.tar.bz2
# tar jxf mod_mce-0.1.3.tar.bz2
# cd mod_mce/
# make


At this point make gives the following error

Code:
make -C /lib/modules/2.6.18-chw-13/build SUBDIRS=/tmp/mod_mce modules
make[1]: Entering directory `/usr/src/linux-source-2.6.18-chw-13'

  WARNING: Symbol version dump /usr/src/linux-source-2.6.18-chw-13/Module.symvers
           is missing; modules will have no dependencies and modversions.

  CC [M]  /tmp/mod_mce/mod_mce.o
/tmp/mod_mce/mod_mce.c:52:30: error: linux/usb_input.h: No such file or directory
/tmp/mod_mce/mod_mce.c: In function 'usb_probe':
/tmp/mod_mce/mod_mce.c:656: warning: implicit declaration of function 'usb_to_input_id'
make[2]: *** [/tmp/mod_mce/mod_mce.o] Error 1
make[1]: *** [_module_/tmp/mod_mce] Error 2
make[1]: Leaving directory `/usr/src/linux-source-2.6.18-chw-13'
make: *** [default] Error 2


I've already downloaded & installed the kernel source as per other posts (so I could compile Nvidia and RT73 drivers). Looking in /lib/modules/2.6.18-chw-13/build/include/linux/ I see that usb_input.h doesn't exist (whereas it does on a test SUSE Linux 10.1 box I have at work with kernel 2.6.16).

Had the above steps worked, mod_mce.ko would've been created and then ./install.sh could've been used to "install" the driver.

Copying usb_input.h from SUSE Linux 10.1 to KnoppMyth allows the driver to compile but whether it works or not I'll try and find out at home tonight (I'd previously tried lirc_mod_mce which I thought I needed but it didn't work). It certainly allows mod_mce to be built on KnoppMyth running as a VMware guest

Code:
make -C /lib/modules/2.6.18-chw-13/build SUBDIRS=/tmp/mod_mce modules
make[1]: Entering directory `/usr/src/linux-source-2.6.18-chw-13'

  WARNING: Symbol version dump /usr/src/linux-source-2.6.18-chw-13/Module.symvers
           is missing; modules will have no dependencies and modversions.

  CC [M]  /tmp/mod_mce/mod_mce.o
  Building modules, stage 2.
  MODPOST
  CC      /tmp/mod_mce/mod_mce.mod.o
  LD [M]  /tmp/mod_mce/mod_mce.ko
make[1]: Leaving directory `/usr/src/linux-source-2.6.18-chw-13'


For reference usb_input.h (at least from SUSE Linux 10.1) contains

Code:
#ifndef __USB_INPUT_H
#define __USB_INPUT_H

/*
 * Copyright (C) 2005 Dmitry Torokhov
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published by
 * the Free Software Foundation.
 */

#include <linux/usb.h>
#include <linux/input.h>
#include <asm/byteorder.h>

static inline void
usb_to_input_id(const struct usb_device *dev, struct input_id *id)
{
        id->bustype = BUS_USB;
        id->vendor = le16_to_cpu(dev->descriptor.idVendor);
        id->product = le16_to_cpu(dev->descriptor.idProduct);
        id->version = le16_to_cpu(dev->descriptor.bcdDevice);
}

#endif


HTH

Simon

Edits: My test box is running SUSE Linux 10.1 not openSUSE 10.2; mod_mce archive filename is .bz2 not .bz


Last edited by simonflood on Fri Apr 06, 2007 4:26 am, edited 1 time in total.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 8:20 am 
simon
Now remember who you are talking to and take it for what it is worth but after searching for a bit I run across this statement a couple of times

Under changes made to 2.6.18
http://lwn.net/Articles/190058/
    The include file <linux/usb_input.h> is now <linux/usb/input.h>.

and in another place I run across this
Kernel 2.6.18 changed the naming scheme for the usb-headers. To get the driver to compile under 2.6.18, you have to change
Code:
#include <linux/usb_input.h>

to
Code:
#include <linux/usb/input.h>

Maybe the keyboard driver doesn't take the change into consideration. About line 41 in mod_mce.c you run into this phrase.
Code:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
   #include <linux/usb/input.h>
#else
   #include <linux/usb_input.h>
#endif

Maybe it needs to compare against 2.6.18 instead of 2.6.19
just a thought.

Thanks for the install how to. It makes more sense to me now.
TVBox


Top
  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 8:33 am 
Offline
Joined: Tue May 16, 2006 8:41 am
Posts: 47
Location: United Kingdom
TVBox wrote:
Now remember who you are talking to and take it for what it is worth but after searching for a bit I run across this statement a couple of times

Under changes made to 2.6.18
http://lwn.net/Articles/190058/
    The include file <linux/usb_input.h> is now <linux/usb/input.h>.
and in another place I run across this
Kernel 2.6.18 changed the naming scheme for the usb-headers. To get the driver to compile under 2.6.18, you have to change
Code:
#include <linux/usb_input.h>

to
Code:
#include <linux/usb/input.h>

Maybe the keyboard driver doesn't take the change into consideration. About line 41 in mod_mce.c you run into this phrase.
Code:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
   #include <linux/usb/input.h>
#else
   #include <linux/usb_input.h>
#endif

Maybe it needs to compare against 2.6.18 instead of 2.6.19
just a thought.


Ding ding we have a winner! Good find!! (Of course I grep'ed other files in the directory - didn't think to check files in the other directories!)

Before getting mod_mce.c corrected we ought to verify that 2.6.17 uses usb_input.h (as your find would seem to suggest - 2.6.16 appears to use the former). I'm guessing Florian (mod_mce's developer) has kernel 2.6.19 on his development machine.

TVBox wrote:
Thanks for the install how to. It makes more sense to me now.


Glad to help.

Simon


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 8:57 am 
Simon
just a confirmation I also have it.
Code:
/usr/src/linux-headers-2.6.18-chw-13/include/linux/usb/input.h


It looks like it is a USB input kernel patch that was enacted in 2.6.19 and it all depends if the earlier kernels received the patch. It's use seems to go back at least as far as 2.6.14 . I stopped looking there. It looks like cesman was on the ball with those patches. Would it help to know what versions of KM had the patch? I don't see any global fix without adding a lot of code. But I don't code so what do I know.

Say don't get fired over this :D
TVBox


Last edited by TVBox on Thu Apr 05, 2007 12:07 pm, edited 2 times in total.


Top
  
 
 Post subject: mod_mce.patch
PostPosted: Thu Apr 05, 2007 9:13 am 
Offline
Joined: Tue May 16, 2006 8:41 am
Posts: 47
Location: United Kingdom
TVBox wrote:
just a confirmation I also have it.
Code:
/usr/src/linux-headers-2.6.18-chw-13/include/linux/usb/input.h


OK here's a patch file to apply against mod_mce.c from mod_mce-0.1.3.tar.bz2 (hey my first ever patch :))

Code:
49c49
< #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
---
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)


Save it as mod_mce.patch in the same directory where mod_mce-0.1.3.tar.bz2 has been extracted and then do the following

Code:
# patch mod_mce.c mod_mce.patch


This will correct the second kernel test (for usb_input.h vs usb/input.h - first one is for something else) to check for kernel <= 2.6.18.

TVBox wrote:
say don't get fired over this


I hope not, KnoppMyth and mythTV are hobbies (though I wouldn't mind getting paid to do that instead of my real job!).

Simon


Top
 Profile  
 
PostPosted: Thu Apr 05, 2007 5:33 pm 
Offline
Joined: Tue May 16, 2006 8:41 am
Posts: 47
Location: United Kingdom
simonflood wrote:
Copying usb_input.h from SUSE Linux 10.1 to KnoppMyth allows the driver to compile but whether it works or not I'll try and find out at home tonight (I'd previously tried lirc_mod_mce which I thought I needed but it didn't work).


Ok it's (definitely?) lirc_mod_mce that we need if you also want to use the remote as that is what I've got running now and I'm typing this post via the Microsoft MCE keyboard!

I'm not quite sure how I've got here as I'd compiled both mod_mce and lirc_mod_mce (since mod_mce wasn't working) after making the usb_input.h -> usb/input.h change.

I think I used the following to install the lirc_mod_mce module

Code:
# cp lirc_mod_mce.ko /lib/modules/2.6.18-chw-13/misc
# modprobe lirc_mod_mce


I know I also tried 'depmod -a' and 'insmod lirc_mod_mce' at times (you can also substitute 'mod_mce' for 'lirc_mod_mce'!).

If you do the following you should see 5 entries relating to lirc_mod_mce in each file

Code:
# grep mod_mce /lib/modules/2.6.18-chw-13/modules.alias
# gre mod_mce /lib/modules/2.6.18-chw-13/modules.usbmap


What I also hadn't realised is that you need to unplug and then replug the USB receiver and that act will kick the lirc_mod_mce module into life (picked this up after reading and re-reading the Public Forums on the mod-mce SF page). However I seemed to lose the remote since LIRC stops working, 'lircd' starts it again (though I don't think 'irw' then worked).

Things are a bit blurry given the lateness of the hour! It's my intention to rebuild my box as I'm stll in a test phase - I've been trying to document everything I've done (except getting this keyboard working since I suppose I didn't honestly think I would tonight!)

I have found keyboard response isn't as quick as I'd like (I'm a fast typer!), especially if there isn't line of sight between keyboard and receiver.

HTH

Simon


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 5:53 pm 
Simon

I created file mod_mce.patch as follows
mod_mce.patch
Code:
49c49
< #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
---
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)


simonflood Quote:
Quote:
I've already downloaded & installed the kernel source as per other posts

Do you need to have the kernel source installed to run the patch on mod_mce.c I have not installed the kernel source but I run the patch mod_mce.c mod_mce.patch command. This is my code.
Code:
> ls
COPYING
Makefile
install.sh
mod_mce.c
mod_mce.patch
> patch mod_mce.c mod_mce.patch
patching file mod_mce.c
patch unexpectedly ends in middle of line
patch: **** unexpected end of file in patch at line 3
Do I need to install the source to run this or do we have an error in the patch?
TVBox


Last edited by TVBox on Fri Apr 06, 2007 12:16 pm, edited 1 time in total.


Top
  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 11:24 pm 
Offline
Joined: Mon Feb 26, 2007 2:43 pm
Posts: 22
Location: East Coast
By the way, great job on starting this thread TVBOX.
I also installed the kernel source and I got to the "modprobe ..." point.
root@h_mythtv:~# modprobe lirc_mod_mce
FATAL: Module lirc_mod_mce not found.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 06, 2007 4:33 am 
Offline
Joined: Tue May 16, 2006 8:41 am
Posts: 47
Location: United Kingdom
TVBox wrote:
You have a omission error on your 1st post
Code:
# cd /tmp/
# wget http://kent.dl.sourceforge.net/sourceforge/mod-mce/mod_mce-0.1.3.tar.bz2
# tar jxf mod_mce-0.1.3.tar.bz
# cd mod_mce/
# make

can you go back and edit your first post and add a 2 to tar.bz for all those that follow.


Good spot though thought I'd cut 'n' pasted actual command line! Previous post now edited and corrected.

TVBox wrote:
I created file mod_mce.patch as follows
mod_mce.patch
Code:
49c49
< #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
---
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)


simonflood Quote:
Quote:
I've already downloaded & installed the kernel source as per other posts

Do you need to have the kernel source installed to run the patch on mod_mce.c I have not installed the kernel source but I run the patch mod_mce.c mod_mce.patch command. This is my code.
Code:
> ls
COPYING
Makefile
install.sh
mod_mce.c
mod_mce.patch
> patch mod_mce.c mod_mce.patch
patching file mod_mce.c
patch unexpectedly ends in middle of line
patch: **** unexpected end of file in patch at line 3
Do I need to install the source to run this or do we have an error in the patch?


I don't think you need the kernel source to apply the patch but you do need it to compile the driver. See http://mysettopbox.tv/phpBB2/viewtopic.php?t=13281 on how to get & install the kernel source.

Simon


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 06, 2007 4:35 am 
Offline
Joined: Tue May 16, 2006 8:41 am
Posts: 47
Location: United Kingdom
karlec wrote:
I also installed the kernel source and I got to the "modprobe ..." point.
root@h_mythtv:~# modprobe lirc_mod_mce
FATAL: Module lirc_mod_mce not found.


Have you compiled the lirc_mod_mce module?

If so, where have you copied it within /lib/modules/2.6.18-chw-13?

BTW my mod_mce.patch will not work against lirc_mod_mce.c - I'll need to create a new diff to be applied. In the meantime edit it by hand - just change the second KERNEL_VERSION test.

Simon


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 06, 2007 1:14 pm 
simon
I downloaded the source, 42meg over dial up is painful.

I had errors when I ran tar. Is this an ignorable error or is it a bad download of the source code?
Code:
> cd /root/
> dpkg -i linux-source-2.6.18-chw-13_2.6.18-chw-13-10.00.Custom_all.deb
Selecting previously deselected package linux-source-2.6.18-chw-13.
(Reading database ... 81326 files and directories currently installed.)
Unpacking linux-source-2.6.18-chw-13 (from linux-source-2.6.18-chw-13_2.6.18-chw-13-10.00.Custom_all.deb) ...
Setting up linux-source-2.6.18-chw-13 (2.6.18-chw-13-10.00.Custom) ...

> cd /usr/src
> tar xjvf linux-source<tab>
bash: -c: line 0: syntax error near unexpected token `newline'
bash: -c: line 0: `tar xjvf linux-source<tab>'


Edit The errors in the tar command above where corrected by this tar xjvf linux-source-2.6.18-chw-13.tar.bz2

For everybodys information R5D1 has kernel 2.6.17-chw8 and has the usb input patch, so it also has the input-h issue and will need a need a mod_mce driver patch also.
TVBox


Last edited by TVBox on Sat Apr 07, 2007 1:38 am, edited 2 times in total.


Top
  
 
 Post subject:
PostPosted: Fri Apr 06, 2007 2:52 pm 
Offline
Joined: Mon Feb 26, 2007 2:43 pm
Posts: 22
Location: East Coast
simonflood wrote:
[Have you compiled the lirc_mod_mce module?

If so, where have you copied it within /lib/modules/2.6.18-chw-13?

Simon


I followed this:
Code:
# cp lirc_mod_mce.ko /lib/modules/2.6.18-chw-13/misc
# modprobe lirc_mod_mce


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 06, 2007 3:03 pm 
Offline
Joined: Mon Feb 26, 2007 2:43 pm
Posts: 22
Location: East Coast
TVBox wrote:
simon
I downloaded the source, 42meg over dial up is painful.

I had errors when I ran tar. Is this an ignorable error or is it a bad download of the source code?
Code:
> cd /root/
> dpkg -i linux-source-2.6.18-chw-13_2.6.18-chw-13-10.00.Custom_all.deb
Selecting previously deselected package linux-source-2.6.18-chw-13.
(Reading database ... 81326 files and directories currently installed.)
Unpacking http://mysettopbox.tv/phpBB2/viewtopic.php?t=13281 (from linux-source-2.6.18-chw-13_2.6.18-chw-13-10.00.Custom_all.deb) ...
Setting up linux-source-2.6.18-chw-13 (2.6.18-chw-13-10.00.Custom) ...

> cd /usr/src
> tar xjvf linux-source<tab>
bash: -c: line 0: syntax error near unexpected token `newline'
bash: -c: line 0: `tar xjvf linux-source<tab>'

TVBox


TVBOX,

I got the same message,you need to specify the name of the file (kernel) that you are unpacking. that seemed to have worked for me.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 06, 2007 5:45 pm 
simon / karlec

When I installed my other hard drive it had a good working copy of R5D1 on it so I am going to use it because it has the kernel source installed.

Code:
> cd /root/mod_mce/
> ls
Makefile
install.sh
mod_mce.c
mod_mce.patch

> make
make -C /lib/modules/2.6.17-chw-8/build SUBDIRS=/root/mod_mce modules
make[1]: Entering directory `/usr/src/kernel-source-2.6.17-chw-8'
  CC [M]  /root/mod_mce/mod_mce.o
  Building modules, stage 2.
  MODPOST
  CC      /root/mod_mce/mod_mce.mod.o
  LD [M]  /root/mod_mce/mod_mce.ko
make[1]: Leaving directory `/usr/src/kernel-source-2.6.17-chw-8'

> patch mod_mce.c mod_mce.patch
patching file mod_mce.c
patch unexpectedly ends in middle of line
patch: **** unexpected end of file in patch at line 3


I run the make file comand and everything went ok but the patch is still causing me problems. I keep thinking that I need to unpack something else. The line in the driver patch changed from 18 to 17 > #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
Where are the error logs for this stuff located. I checked about 10 different files and struck out
TVBox


Last edited by TVBox on Sat Apr 07, 2007 2:48 am, edited 2 times in total.


Top
  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 37 posts ] 
Go to page 1, 2, 3  Next



All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu