From: Morten B. <lir...@mo...> - 2006-12-26 02:19:07
|
Hello (again) As stated earlier (for those unfortunate people who has already read it I'll repeat. Sorry). I got a iMON 2.4G for christmas. Aparently the usb-id collide with this one: { USB_DEVICE(0x15c2, 0xffdc) }, /* IR & VFD */ But it has different padding packets ie: ff ff ff ff ff ff 4e af So I've made a patch that makes sure that this one is also interpreted as "idle". I then moved the dongle from one computer to another, and it lost the association between the domgle and the remote (I had associated it under win2k/qemu). So with a little help of "modprobe usbmon". I got the sequence needed to associate the two. I've also added a new module parameter (associate_24g) to tell if an associtation should be performed every time the device is opened. This is probably not such a good idea, since it'll open up for a lot of unfortunate associations from neighbours who got a the same type of remote. But this works for now. You can do this: # modprobe lirc_imon associate_24g=1 # irw [press some key on the remote for a couple of seconds] ^C # modprobe -r lirc_imon # modprobe lirc_mon If somebody has any other idea of how to determine when to associate I'm open for suggestions. The attached lircd.conf has a R/G prefix to determine if it is in Red or Green mode. Please try it out (the patch also applies to version 0.8.0 if you don't like to use the cvs version). Merry Christmas & Happy New Year Morten Bogeskov Patch: diff -urN lirc-cvs/drivers/lirc_imon/lirc_imon.c lirc/drivers/lirc_imon/lirc_imon.c --- lirc-cvs/drivers/lirc_imon/lirc_imon.c 2006-12-26 00:34:14.000000000 +0100 +++ lirc/drivers/lirc_imon/lirc_imon.c 2006-12-26 03:01:30.000000000 +0100 @@ -230,6 +230,7 @@ static DECLARE_MUTEX (disconnect_sem); static int debug = 0; +static int associate_24g = 0; #if !defined(KERNEL_2_5) @@ -256,7 +257,9 @@ MODULE_DESCRIPTION (MOD_DESC); MODULE_LICENSE ("GPL"); module_param (debug, int, 0); +module_param (associate_24g, int, 0); MODULE_PARM_DESC (debug, "Debug messages: 0=no, 1=yes (default: no)"); +MODULE_PARM_DESC (associate_24g, "Autoassociate iMON 2.4G remote: 0=no, 1=yes (default: no)"); static inline void delete_context (struct imon_context *context) { @@ -445,6 +448,48 @@ } /** + * Sends an associate packet to the iMON 2.4G. + * + * This might not be such a good idea, since it has an id + * collition with some versions of the "IR & VFD" combo. + * The only way to determine if it is a RF version is to look + * at the product description string. (Which we currently do + * not fetch). + */ +static inline int send_associate_24g (struct imon_context *context) +{ + int retval; + const unsigned char packet[8] = { 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20 }; + + if (!context) { + err ("%s: no context for device", __FUNCTION__); + return -ENODEV; + } + + LOCK_CONTEXT; + + if (!context ->dev_present) { + err ("%s: no iMON device present", __FUNCTION__); + retval = -ENODEV; + goto exit; + } + + memcpy (context ->usb_tx_buf, packet, sizeof(packet)); + +#ifdef DEBUG + printk ("%s Setting IMON 2.4G in assosiate state\n", __FUNCTION__); +#endif + + retval = send_packet (context); + +exit: + UNLOCK_CONTEXT; + + return retval; +} + +/** * Writes data to the VFD. The IMON VFD is 2x16 characters * and requires data in 5 consecutive USB interrupt packets, * each packet but the last carrying 7 bytes. @@ -558,6 +603,7 @@ static int ir_open (void *data) { int retval = SUCCESS; + int do_associate_24g = FALSE; struct imon_context *context; /* prevent races with disconnect */ @@ -597,11 +643,16 @@ MOD_INC_USE_COUNT; context ->ir_isopen = TRUE; info ("IR port opened"); + do_associate_24g = associate_24g; } exit: UNLOCK_CONTEXT; + if (do_associate_24g) + send_associate_24g (context); + + up (&disconnect_sem); return SUCCESS; } @@ -695,6 +746,11 @@ if (chunk_num == 0xFF) return; /* filler frame, no data here */ + if (buf [5] == 0xFF && + buf [6] == 0x4E && + buf [7] == 0xAF) + return; /* filler frame, no data here (2.4G USB)*/ + #ifdef DEBUG { int i; diff -urN lirc-cvs/remotes/imon/lircd.conf.imon-2.4g lirc/remotes/imon/lircd.conf.imon-2.4g --- lirc-cvs/remotes/imon/lircd.conf.imon-2.4g 1970-01-01 01:00:00.000000000 +0100 +++ lirc/remotes/imon/lircd.conf.imon-2.4g 2006-12-26 00:32:05.000000000 +0100 @@ -0,0 +1,94 @@ + +# Please make this file available to others +# by sending it to <li...@ba...> +# +# this config file was automatically generated +# using lirc-0.8.0(imon_pad) on Tue Dec 26 00:13:14 2006 +# +# contributed by +# +# brand: 1.conf +# model no. of remote control: +# devices being controlled by this remote: +# + +begin remote + + name lircd.conf.imon-2.4g + bits 32 + eps 30 + aeps 100 + + one 0 0 + zero 0 0 + gap 115986 + toggle_bit 0 + + + begin codes + RAppExit 0xBB4431CE + REject 0xBB4432CD + RPower 0xBB4403FC + RAppLauncher 0xBB4437C8 + RTaskSwitcher 0xBB4439C6 + RBack 0xBB443DC2 + RSelect 0xBB443FC0 + RChannelUp 0xBB443EC1 + RChannelDown 0xBB4443BC + RVolumeUp 0xBB4445BA + RVolumeDown 0xBB4444BB + RNext 0xBB444CB3 + RPrev 0xBB444DB2 + RFf 0xBB444FB0 + RRew 0xBB444EB1 + RI 0xBB4450AF + RMute 0xBB4449B6 + RTv 0xBB444AB5 + RMenu 0xBB444BB4 + R1 0xBB4434CB + R2 0xBB4435CA + R3 0xBB4436C9 + R4 0xBB443AC5 + R5 0xBB443BC4 + R6 0xBB443CC3 + R7 0xBB4440BF + R8 0xBB4441BE + R9 0xBB4442BD + RSkipBack 0xBB4446B9 + R0 0xBB4447B8 + RSkipFwd 0xBB4448B7 + + GAppExit 0xBB4401FE + GEject 0xBB4402FD + GPower 0xBB4403FC + GAppLauncher 0xBB4407F8 + GTaskSwitcher 0xBB4409F6 + GBack 0xBB440DF2 + GSelect 0xBB440FF0 + GChannelUp 0xBB440EF1 + GChannelDown 0xBB4413EC + GVolumeUp 0xBB4415EA + GVolumeDown 0xBB4414EB + GNext 0xBB441CE3 + GPrev 0xBB441DE2 + GFf 0xBB441FE0 + GRew 0xBB441EE1 + GI 0xBB4420DF + GMute 0xBB4419E6 + GTv 0xBB441AE5 + RMenu 0xBB441BE4 + G1 0xBB4404FB + G2 0xBB4405FA + G3 0xBB4406F9 + G4 0xBB440AF5 + G5 0xBB440BF4 + G6 0xBB440CF3 + G7 0xBB4410EF + G8 0xBB4411EE + G9 0xBB4412ED + GSkipBack 0xBB4416E9 + G0 0xBB4417E8 + GSkipFwd 0xBB4418E7 + end codes + +end remote |