~ubuntu-branches/ubuntu/natty/lirc/natty

« back to all changes in this revision

Viewing changes to drivers/lirc_igorplugusb/lirc_igorplugusb.c

  • Committer: Bazaar Package Importer
  • Author(s): Mario Limonciello, Jeremy Yoder, Mario Limonciello
  • Date: 2009-10-12 21:16:10 UTC
  • mfrom: (1.2.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20091012211610-z63bnon17ahmxgd1
Tags: 0.8.6-0ubuntu1
[ Jeremy Yoder ]
* Update to LIRC 0.8.6 release. (LP: #432678)
  - added support for ENE KB3926 revision B/C/D (ENE0100) CIR port
    (found on some notebooks, e.g: Acer Aspire 5720G, HP Pavilion dv5)
    (Maxim Levitsky)
  - New parameter for lircd: --repeat-max
  - merged 1st-gen mceusb device support into lirc_mceusb2,
    renamed lirc_mceusb2 to lirc_mceusb
  - added support for putting iMON receviers into MCE/RC6 mode
  - added input subsystem mouse device support to iMON driver
  - improved iMON driver to handle dual-interface iMON devices
    via a single lirc device, reducing configuration complexity
  - added support for more iMON devices, including proper support
    for touchscreen iMON devices (Rene Harder)
  - improved iMON driver including touchscreen support
  - Linux input support added to lircmd
  - added support for IT8720 CIR port
  - added support for XMP protocol
* Cleanup more_remotes.hwdb
* TODO:  Make changes to the "lircd.conf.atiusb" and
  "lircd.conf.hauppauge" files PATCHES instead of duplicates
* TODO:  Submit "lircd.conf.atiusb" and
  "lircd.conf.hauppauge" file patches upstream again
* Changed lirc init script to create socket in /var/run/lirc/lircd
  as is the new default, but also create a symlink /dev/lircd
  to point to it.  This makes all clients happy, old and new.
* Fix bug in dkms.conf.in, forgot to increment array number
  when adding ene0100 driver.
* Added the extra "Debian-only" remotes and transmitters back
  in, but in a different way.  I created a subdirectory 
  "debian/extras" and copy that to /usr/share/lirc/extras.
  This avoids patching the source.
  NOTE: CONFIG FILES IN BOTH LOCATIONS WILL USE THE "extras"
  VERSION.  DUPLICATE LINES IN lirc.hwdb AND extras/remotes.hwdb
  WILL USE THE extras/remotes.hwdb VERSION.  TRY TO AVOID THIS.
* Added support to build new ene0100 driver
* Update debian/lircd.init.d to reflect new default
  PID location in /var/run/lirc
* Update debian/lircd.init.d to force socket to /dev/lircd
  rather than the new default of /var/run/lirc/lircd
* Add support for new lirc-extras package to
  debian/lirc.postinst
* Remove /etc/lircd.conf link to /etc/lirc since
  0.8.6 defaults to /etc/lirc/lircd.conf now
* Drop 04_man_pages patch, included in upstream
* Drop 16_lirc-gpio in favor of a sed line in debian/rules
* Drop 28_irrecord_resume_support - Doesn't work
  according to upstream
* Drop 36_remove_extra_tekram in favor of a minor
  tweak to debian/lirc.postinst to ignore duplicates
* Drop extra remote control/transmitter patches, move to lirc-extras:
  - 21_atiusb
  - 22_hauppauge_novat_500
  - 23_remove_md8800
  - 24_freecom_dvbt
  - 26_transmitter_lircd.conf
  - 30_medion_md1_remote
  - 31_hauppauge_hvr_1100
  - 32_radioshack_15_2116_remote
  - 33_asus_mycinema_remote
  - 34_nebula_digitaltv_remote
  - 35_general_deviniput
  - 37_msi_tv_anywhere
  - 38_encore_enltv
* Cleaned up a few lintian warnings

[ Mario Limonciello ]
* lirc.init.d:
  - Merge a bunch of whitespace cleanup from debian.
* control:
  - Merge whitespace cleanup from debian.
  - Drop breaks on udev.  We don't have any older version of udev in karmic.
* copyright:
  - Sync from debian.
* watch:
  - Sync from debian.
* links:
  - Don't link to a transmitterdb, this should be provided by lirc-extras.
* rules:
  - Install extra changelog, as mentioned in debian's debian/rules.
* dkms.conf.in:
  - Drop bashisms. (LP: #445175)
* lirc.postinst:
  - On upgrades from earlier versions, require the user to reconfigure
    their remote and transmitter.
* lirc-modules-source.postinst:
  - Update to use the DKMS common postinst template.
 

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
#endif
70
70
 
71
71
/* module identification */
72
 
#define DRIVER_VERSION          "0.1"
 
72
#define DRIVER_VERSION          "0.2"
73
73
#define DRIVER_AUTHOR           \
74
74
        "Jan M. Hochstein <hochstein@algo.informatik.tu-darmstadt.de>"
75
75
#define DRIVER_DESC             "USB remote driver for LIRC"
268
268
        MOD_DEC_USE_COUNT;
269
269
}
270
270
 
 
271
static void send_fragment(struct igorplug *ir, struct lirc_buffer *buf,
 
272
                           int i, int max)
 
273
{
 
274
        /* MODE2: pulse/space (PULSE_BIT) in 1us units */
 
275
        while (i < max) {
 
276
                /* 1 Igor-tick = 85.333333 us */
 
277
                lirc_t code = (unsigned int)ir->buf_in[i] * 85 +
 
278
                        (unsigned int)ir->buf_in[i] / 3;
 
279
                ir->last_time.tv_usec += code;
 
280
                if (ir->in_space)
 
281
                        code |= PULSE_BIT;
 
282
                lirc_buffer_write_n(buf, (unsigned char *)&code, 1);
 
283
                /* 1 chunk = CODE_LENGTH bytes */
 
284
                ir->in_space ^= 1;
 
285
                ++i;
 
286
        }
 
287
}
271
288
 
272
289
/**
273
290
 * Called in user context.
292
309
              ir->buf_in, ir->len_in,
293
310
              /*timeout*/HZ * USB_CTRL_GET_TIMEOUT);
294
311
        if (ret > 0) {
295
 
                int i = DEVICE_HEADERLEN;
296
312
                lirc_t code, timediff;
297
313
                struct timeval now;
298
314
 
299
 
                if (ret <= 1)  /* ACK packet has 1 byte --> ignore */
 
315
                /* ACK packet has 1 byte --> ignore */
 
316
                if (ret < DEVICE_HEADERLEN)
300
317
                        return -ENODATA;
301
318
 
302
319
                dprintk(": Got %d bytes. Header: %02x %02x %02x\n",
303
320
                        ret, ir->buf_in[0], ir->buf_in[1], ir->buf_in[2]);
304
321
 
305
 
                if (ir->buf_in[2] != 0) {
306
 
                        printk(KERN_WARNING DRIVER_NAME
307
 
                               "[%d]: Device buffer overrun.\n", ir->devnum);
308
 
                        /* start at earliest byte */
309
 
                        i = DEVICE_HEADERLEN + ir->buf_in[2];
310
 
                        /* where are we now? space, gap or pulse? */
311
 
                }
312
 
 
313
322
                do_gettimeofday(&now);
314
323
                timediff = now.tv_sec - ir->last_time.tv_sec;
315
324
                if (timediff + 1 > PULSE_MASK / 1000000)
326
335
                lirc_buffer_write(buf, (unsigned char *)&code);
327
336
                ir->in_space = 1;   /* next comes a pulse */
328
337
 
329
 
                /* MODE2: pulse/space (PULSE_BIT) in 1us units */
330
 
 
331
 
                while (i < ret) {
332
 
                        /* 1 Igor-tick = 85.333333 us */
333
 
                        code = (unsigned int)ir->buf_in[i] * 85
334
 
                                + (unsigned int)ir->buf_in[i] / 3;
335
 
                        ir->last_time.tv_usec += code;
336
 
                        if (ir->in_space)
337
 
                                code |= PULSE_BIT;
338
 
                        lirc_buffer_write(buf, (unsigned char *)&code);
339
 
                        /* 1 chunk = CODE_LENGTH bytes */
340
 
                        ir->in_space ^= 1;
341
 
                        ++i;
 
338
                if (ir->buf_in[2] == 0)
 
339
                        send_fragment(ir, buf, DEVICE_HEADERLEN, ret);
 
340
                else {
 
341
                        printk(KERN_WARNING DRIVER_NAME
 
342
                               "[%d]: Device buffer overrun.\n", ir->devnum);
 
343
                        /* HHHNNNNNNNNNNNOOOOOOOO H = header
 
344
                              <---[2]--->         N = newer
 
345
                           <---------ret--------> O = older */
 
346
                        ir->buf_in[2] %= ret - DEVICE_HEADERLEN; /* sanitize */
 
347
                        /* keep even-ness to not desync pulse/pause */
 
348
                        send_fragment(ir, buf, DEVICE_HEADERLEN +
 
349
                                      ir->buf_in[2] - (ir->buf_in[2] & 1),
 
350
                                      ret);
 
351
                        send_fragment(ir, buf, DEVICE_HEADERLEN,
 
352
                                      DEVICE_HEADERLEN + ir->buf_in[2]);
342
353
                }
343
354
 
344
355
                ret = usb_control_msg(
569
580
static struct usb_device_id usb_remote_id_table [] = {
570
581
        /* Igor Plug USB (Atmel's Manufact. ID) */
571
582
        { USB_DEVICE(0x03eb, 0x0002) },
 
583
        /* Fit PC2 Infrared Adapter */
 
584
        { USB_DEVICE(0x03eb, 0x21fe) },
572
585
 
573
586
        /* Terminating entry */
574
587
        { }