View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 19 posts ] 
Go to page Previous  1, 2

Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Tue Jun 14, 2005 6:28 pm 
Offline
Joined: Wed Jan 07, 2004 12:14 pm
Posts: 434
Location: Charlotte, NC
FINALLY!!!

Posted the solution to the WIKI (http://www.knoppmythwiki.org/index.php?page=LIRCHowTo). Let me know if you have a problem.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 16, 2005 7:49 am 
Offline
Joined: Tue Apr 13, 2004 6:51 pm
Posts: 890
Location: Groton, MA
hmmm, just read the post you referenced. I think I tried that before. The only piece that I haven't done since the move to A16 was use irrecord to create a lircd.conf file. I'm using the file i generated with R4V5 that worked perfectly. That can't be my issue, can it?

To summarize the R5A16 steps

1) apt-get remove lirc
2) assure linux sources are availible
3) install lirc-0.7.0
4) config, make, install
5) configure modules + lirc

Most of these steps are straight forward (you either type 'make' or you dont). maybe my module config/loading is amiss.

my related module files are (sorry for the length) :

/etc/modutils/lirc only has one line (the post says "on both lines")
Code:
alias char-major-61-0 lirc_serial


Code:
root@mythtv:/etc # cat modules
# /etc/modules: kernel modules to load at boot time.
#
# This file should contain the names of kernel modules that are
# to be loaded at boot time, one per line.  Comments begin with
# a `#', and everything on the line after them are ignored.
BusLogic
tmscsim
usbcore
uhci_hcd
ohci_hcd
usb_storage
ieee1394
rtc
ac
battery
button
container
fan
processor
thermal
video
pcmcia_core
rsrc_nonstatic
yenta_socket
pcmcia
ohci1394
serial_core
8250
parport
parport_pc
agpgart
intel_agp
hw_random
map_funcs
chipreg
mtdcore
i2c_core
i2c_i801
mii
e100
soundcore
snd
snd_page_alloc
snd_timer
snd_pcm
snd_ac97_codec
snd_intel8x0
snd_mixer_oss
af_packet
autofs4
ipv6
md5


Code:
root@mythtv:/etc # egrep "(lirc|serial)" modules.conf
### update-modules: start processing /etc/modutils/lirc
#This file is modified by lirc's maintainer scripts.
#               add options lirc_serial sense=0
alias char-major-61-0 lirc_serial
### update-modules: end processing /etc/modutils/lirc
### update-modules: start processing /etc/modutils/setserial
#post-install serial /etc/init.d/setserial start | logger -p daemon.info -t "setserial-module reload"
#pre-remove serial /etc/init.d/setserial stop | logger -p daemon.info -t "setserial-module uload"
alias /dev/tts          serial
alias /dev/tts/0        serial
alias /dev/tts/1        serial
alias /dev/tts/2        serial
alias /dev/tts/3        serial
post-install serial /etc/init.d/setserial modload > /dev/null 2> /dev/null
pre-remove serial /etc/init.d/setserial modsave  > /dev/null 2> /dev/null
### update-modules: end processing /etc/modutils/setserial


bottom of /etc/init.d/bootmisc.sh
Code:
setserial /dev/ttyS0 uart none
modprobe lirc_serial
/usr/local/sbin/lircd
/usr/local/sbin/lircmd


and finally

Code:
root@mythtv:/etc/init.d # /usr/local/sbin/lircd -v
lircd 0.7.0

_________________
R5F1 - Dell P4 2.4Ghz 500MB - PVR250 x 2 - GeForce FX 5200 - Onboard sound/NIC 80GB ATA/250GB ATA/400GB SATA


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 16, 2005 10:12 am 
Offline
Joined: Wed Jan 07, 2004 12:14 pm
Posts: 434
Location: Charlotte, NC
I am using the same lircd.conf and lircrc that I have had since before R4V5 (can't remember how old...) so I don't think that is your issue. The difference in process (admittedly I am not sure why yet) is that I did not alter modutils (or any other update to modules) nor did I alter ivtv (still says "alias char-major-61-0 lirc_i2c").

I did the same thing you did and coud not make it work. So I started over with a fresh build (have built 3 so far following the steps in the wiki exactly and have had no problems - don't alter modules or ivtv).

Also notice bootmisc.sh (lircmd is not there) - when I added it, it didn't work.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 16, 2005 6:42 pm 
Offline
Joined: Tue Apr 13, 2004 6:51 pm
Posts: 890
Location: Groton, MA
Well, I have my remote working, but it wasnt easy. I added a pile of printk statements to the code that was griping, lirc-0.7.1/drivers/lirc_serial/lirc_serial.c. printk statements output to the /var/log/kern.log file where I was seeing the error dump. By seeing which line of code preceeded the dump, I found the problematic statement. And by shit-luck the statement was buried in an #ifdef / #else block. So I forced the compiler to take the other path and joy, joy success.

Tech details:

Top of lirc_serial.c has
Code:
#if defined(rdtsc)

#define USE_RDTSC
#warning "Note: using rdtsc instruction"
#endif

further down
Code:
#ifdef USE_RDTSC
/* This is an overflow/precision juggle, complicated in that we can't
   do long long divide in the kernel */

/* When we use the rdtsc instruction to measure clocks, we keep the
 * pulse and space widths as clock cycles.  As this is CPU speed
 * dependent, the widths must be calculated in init_port and ioctl
 * time
 */

/* So send_pulse can quickly convert microseconds to clocks */
static unsigned long conv_us_to_clocks = 0;

static inline int init_timing_params(unsigned int new_duty_cycle,
                unsigned int new_freq)
{
        unsigned long long loops_per_sec,work;

        duty_cycle=new_duty_cycle;
        freq=new_freq;

        loops_per_sec=current_cpu_data.loops_per_jiffy;
        loops_per_sec*=HZ;

        /* How many clocks in a microsecond?, avoiding long long divide */
        work=loops_per_sec;
        work*=4295;  /* 4295 = 2^32 / 1e6 */
        conv_us_to_clocks=(work>>32);

        /* Carrier period in clocks, approach good up to 32GHz clock,
           gets carrier frequency within 8Hz */
        period=loops_per_sec>>3;
        period/=(freq>>3);

        /* Derive pulse and space from the period */

        pulse_width = period*duty_cycle/100;
        space_width = period - pulse_width;
        dprintk("in init_timing_params, freq=%d, duty_cycle=%d, "
                "clk/jiffy=%ld, pulse=%ld, space=%ld, "
                "conv_us_to_clocks=%ld\n",
                freq, duty_cycle, current_cpu_data.loops_per_jiffy,
                pulse_width, space_width, conv_us_to_clocks);
        return 0;
}
#else /* ! USE_RDTSC */
static inline int init_timing_params(unsigned int new_duty_cycle,
                unsigned int new_freq)
{
/* period, pulse/space width are kept with 8 binary places -
 * IE multiplied by 256. */
        if(256*1000000L/new_freq*new_duty_cycle/100<=
           LIRC_SERIAL_TRANSMITTER_LATENCY) return(-EINVAL);
        if(256*1000000L/new_freq*(100-new_duty_cycle)/100<=
           LIRC_SERIAL_TRANSMITTER_LATENCY) return(-EINVAL);
        duty_cycle=new_duty_cycle;
        freq=new_freq;
        period=256*1000000L/freq;
        pulse_width=period*duty_cycle/100;
        space_width=period-pulse_width;
        dprintk("in init_timing_params, freq=%d pulse=%ld, "
                "space=%ld\n", freq, pulse_width, space_width);
        return 0;
}
#endif /* USE_RDTSC */

Somehow rtdsc is defined so the first block is used. However, the line in the first block causes the modprobe failure.
Code:
loops_per_sec=current_cpu_data.loops_per_jiffy;

The first block should provide better timings if functional, but I prefer less-accurate timings that at least load.


STEPS TO FIX - This is a hack, that works for me, Im sure there are better ways.

To force the compiler to use the second block, I change

lirc-0.7.1/drivers/lirc_serial/lirc_serial.c line 109

from:
Code:
Old Code:
    #define USE_RDTSC

to:
Code:
New Code:
     #define DONT_USE_RDTSC


then
Code:
killall lircd
make
make install
rmmod lirc_serial
modprobe lirc_serial
lircd

_________________
R5F1 - Dell P4 2.4Ghz 500MB - PVR250 x 2 - GeForce FX 5200 - Onboard sound/NIC 80GB ATA/250GB ATA/400GB SATA


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ] 
Go to page Previous  1, 2



All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 4 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:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu