]> git.etc.gen.nz Git - sapphire-remote.git/commitdiff
New upstream release
authorAndrew Ruthven <andrew@etc.gen.nz>
Sat, 16 Feb 2019 07:20:20 +0000 (07:20 +0000)
committerAndrew Ruthven <andrew@etc.gen.nz>
Sat, 16 Feb 2019 07:33:40 +0000 (07:33 +0000)
13 files changed:
debian/changelog
debian/files
debian/rules
sapphire-remote-7.1/Makefile [moved from sapphire-remote-6.6/Makefile with 94% similarity]
sapphire-remote-7.1/README.txt [moved from sapphire-remote-6.6/README.txt with 100% similarity]
sapphire-remote-7.1/dkms.conf [moved from sapphire-remote-6.6/dkms.conf with 94% similarity]
sapphire-remote-7.1/extract_keydefs.sh [moved from sapphire-remote-6.6/extract_keydefs.sh with 100% similarity]
sapphire-remote-7.1/keymap.default [moved from sapphire-remote-6.6/keymap.default with 100% similarity]
sapphire-remote-7.1/sapphire.c [moved from sapphire-remote-6.6/sapphire.c with 95% similarity]
sapphire-remote-7.1/sapphire.h [moved from sapphire-remote-6.6/sapphire.h with 58% similarity]
sapphire-remote-7.1/sapphire_keymap.sh.part1 [moved from sapphire-remote-6.6/sapphire_keymap.sh.part1 with 100% similarity]
sapphire-remote-7.1/sapphire_keymap.sh.part3 [moved from sapphire-remote-6.6/sapphire_keymap.sh.part3 with 100% similarity]
sapphire-remote-7.1/sapphire_startup.sh [moved from sapphire-remote-6.6/sapphire_startup.sh with 81% similarity]

index 5c120b41b8324b132f7d58868f6efb70dc2875dc..803fdacc7c544f5b24cf18bd23838db6b2607684 100755 (executable)
@@ -1,6 +1,12 @@
+sapphire-remote-dkms (7.1) UNRELEASED; urgency=medium
+
+  * New upstream release
+
+ -- Andrew Ruthven <andrew@etc.gen.nz>  Sat, 16 Feb 2019 07:19:10 +0000
+
 sapphire-remote-dkms (6.6) stable; urgency=low
 
   * Automatically packaged by DKMS.
 
- -- Dynamic Kernel Modules Support Team <pkg-dkms-maint@lists.alioth.debian.org>  Sun, 21 Aug 2016 21:31:06 +0000
+ -- Andrew Ruthven <andrew@etc.gen.nz>  Sun, 21 Aug 2016 21:31:06 +0000
 
index e2bfa16d30d8a126e8da06a43e1662636360d2e4..acf6376d3ee10b0fabf1d42d87e524209d3baf8e 100644 (file)
@@ -1,2 +1,3 @@
-sapphire-remote-dkms_6.6_all.deb misc optional
-sapphire-remote_6.6_all.deb misc optional
+sapphire-remote-dkms_7.1_all.deb misc optional
+sapphire-remote-dkms_7.1_armhf.buildinfo misc optional
+sapphire-remote_7.1_all.deb misc optional
index 0a2855e2231096103ed5d379585e7949c93df0eb..82e59b2fc65413049c554a326451a90307bc9928 100755 (executable)
@@ -6,7 +6,7 @@
 
 DEB_NAME=sapphire-remote
 NAME=sapphire-remote
-VERSION=6.6
+VERSION=7.1
 
 configure: configure-stamp
 configure-stamp:
similarity index 94%
rename from sapphire-remote-6.6/Makefile
rename to sapphire-remote-7.1/Makefile
index 8fd1233ea85540c1e5bcb6c7985071f6a88fd8d3..16d0e143b28d54b1fc809b538c55650e8cc373bb 100644 (file)
@@ -1,6 +1,6 @@
 #
 # Makefile and (un-)Installer for Sapphire remote control driver,
-#    by Mark Lord 2012-2015.
+#    by Mark Lord 2012-2018.
 #
 MODNAME=sapphire
 MODSOURCE=$(MODNAME).c
@@ -55,7 +55,7 @@ $(BLACKLIST):
 
 modinstall: $(MODNAME).ko $(KEYMAP_SCRIPT)
        $(MAKE) -C $(KDIR)/build M=$(CWD) modules_install || exit 0
-       @[ -e $(KDIR)/extra/sapphire.ko ] || exit 1
+       @[ -e $(KDIR)/extra/sapphire.ko -o -e $(KDIR)/extra/sapphire.ko.gz -o -e $(KDIR)/extra/sapphire.ko.xz ] || exit 1
        depmod $(KVER)
        @if [ "$(KVER)" = "$$(uname -r)" ]; then \
                rmmod $(MODNAME)   2>/dev/null ;\
similarity index 94%
rename from sapphire-remote-6.6/dkms.conf
rename to sapphire-remote-7.1/dkms.conf
index 7c4066e06d41aafdacd6d59d569410222abdc5d3..1217b3e3f9a8006736daebb31bafbfa71d39b212 100644 (file)
@@ -1,4 +1,4 @@
-PACKAGE_VERSION="6.6"
+PACKAGE_VERSION="7.1"
 
 # Items below here should not have to change with each driver version
 PACKAGE_NAME="sapphire-remote"
similarity index 95%
rename from sapphire-remote-6.6/sapphire.c
rename to sapphire-remote-7.1/sapphire.c
index b7414b070800dc6f2fdb77d83057095526db5ba6..3d1ddb01f82c765d910e198f24d7bb5477156fad 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * sapphire.c
  *
- * Copyright Mark Lord <mlord@pobox.com>, 2012-2015.
+ * Copyright Mark Lord <mlord@pobox.com>, 2012-2018.
  * http://rtr.ca/sapphire_remote/
  *
  * This is a HID driver for the TopSeed Cyberlink receiver
@@ -38,7 +38,7 @@
 #include "sapphire.h"
 
 #define SAPPHIRE_NAME          "sapphire"
-#define SAPPHIRE_VERSION       "6.6"
+#define SAPPHIRE_VERSION       "7.1"
 
 /*
  * "LONGKEY":  Any button can be used to generate a second, different keycode,
@@ -55,7 +55,7 @@
  * EDIT the "keycode" and "repeats" columns below to customize the keymap to your needs:
  */
 #define SAPPHIRE_NUM_BUTTONS   46   /* The Sapphire remote sends 46 unique button codes */
-#define SAPPHIRE_KEYMAP_SIZE   (2 * SAPPHIRE_NUM_BUTTONS)  /* Extra room for a full XAPPHIRE_* set */
+#define SAPPHIRE_KEYMAP_SIZE   (SAPPHIRE_NUM_BUTTONS)
 static struct sapphire_map {
        unsigned int button;   /* raw data from sensor */
        unsigned int keycode;  /* keyboard value to pass to mythtv, or "0" for nothing */
@@ -130,6 +130,19 @@ static unsigned int sapphire_macros[8][8] = {
        /* KEY_MACRO_7 */ {0,}
 };
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
+#define SAPPHIRE_TIMER_ARG_T unsigned long
+static inline void sapphire_timer_setup(struct timer_list *timer_p, void *callback)
+{
+       init_timer(timer_p);
+       timer_p->function = callback;
+       timer_p->data = (long)timer_p;
+}
+#else
+#define sapphire_timer_setup(timer_p, callback)  timer_setup(timer_p, callback, 0)
+#define SAPPHIRE_TIMER_ARG_T struct timer_list *
+#endif
+
 static struct sapphire_dev {
        spinlock_t              lock;
        struct input_dev        *idev;
@@ -268,7 +281,7 @@ static void sapphire_send_key(unsigned int key, unsigned int repeat_delay)
 /*
  * Timer callback function, used to handle repeats and "LONGKEYs".
  */
-static void sapphire_key_timeout(unsigned long data)
+static void sapphire_key_timeout(SAPPHIRE_TIMER_ARG_T arg)
 {
        unsigned long flags;
 
@@ -336,7 +349,7 @@ static void sapphire_handle_key (unsigned int key, unsigned int repeats)
                        repeat_delay = (HZ/2) - (HZ/6);
                        next_repeat  = (HZ/3) | RAMPING;
                        break;
-               default:  /* LONGKEY or NO_REPEAT */
+               default:
                        if (repeats & LONGKEY) {
                                /*
                                 * We don't know if it's a short or long press yet.
@@ -390,6 +403,28 @@ static void sapphire_event(u32 data)
        sapphire_save_key(0);  /* timestamp the event in /proc/, for shutdown timing.. */
 }
 
+/*
+ * Debouncing, primarily for when multiple receivers are used with a single remote.
+ */
+static int sapphire_debounce (u32 data)
+{
+       static u32 debounce_data;
+       static u64 debounce_time;
+       u64 now = get_jiffies_64();
+
+       if (debounce_time && data == debounce_data) {
+               u64 elapsed = now - debounce_time;
+               if (elapsed < (HZ/8)) {
+                       //printk(KERN_INFO "d=%08x ld=%08x t=%llu lt=%llu IGNORE\n", data, debounce_data, now, debounce_time);
+                       return 0;  /* discard */
+               }
+       }
+       //printk(KERN_INFO "k=%08x lk=%08x t=%llu lt=%llu\n", data, debounce_data, now, debounce_time);
+       debounce_data = data;
+       debounce_time = now;
+       return 1;  /* keep */
+}
+
 /*
  * This gets called each time the IR receiver "receives" something from a remote control.
  * The "size" of "raw_data" bytes received varies depending upon the button pressed,
@@ -411,7 +446,8 @@ static int sapphire_raw_event(struct hid_device *hdev, struct hid_report *report
                for (i = size; i > 0; )
                        data = (data << 8) | raw_data[--i];
                spin_lock_irqsave(&dev->lock, flags);
-               sapphire_event(data);
+               if (sapphire_debounce(data))
+                       sapphire_event(data);
                spin_unlock_irqrestore(&dev->lock, flags);
        }
        return -1;  /* event was handled (used to return "1" here) */
@@ -639,6 +675,7 @@ static void sapphire_create_proc_entry (void)
 static int sapphire_probe(struct hid_device *hdev, const struct hid_device_id *id)
 {
        int ret = hid_parse(hdev);
+printk(KERN_INFO "%s: hdev=%p id=%p\n", __func__, hdev, id);
        if (ret)
                return ret;
                ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
@@ -661,6 +698,7 @@ static int sapphire_probe(struct hid_device *hdev, const struct hid_device_id *i
  */
 static void sapphire_remove(struct hid_device *hdev)
 {
+printk(KERN_INFO "%s: hdev=%p\n", __func__, hdev);
        /*
         * We are supposed to do hid_hw_stop() here.
         * But some Ubuntu kernels (eg. 3.11.x, 3.2.x) totally kill the device
@@ -756,9 +794,7 @@ static int sapphire_create (void)
 
        memset(dev, 0, sizeof(*dev));   /* paranoia */
        spin_lock_init(&dev->lock);
-       init_timer(&dev->key_timer);
-       dev->key_timer.function = sapphire_key_timeout;
-       dev->key_timer.data     = (unsigned long)dev;
+       sapphire_timer_setup(&dev->key_timer, sapphire_key_timeout);
 
        dev->idev = input_allocate_device();
        if (!dev->idev) {
similarity index 58%
rename from sapphire-remote-6.6/sapphire.h
rename to sapphire-remote-7.1/sapphire.h
index f6305b4b5a5cf1d7aaa45292674722baf1deb62d..c794e17e76bdba30c37c08bd86cf9aa2c567505e 100644 (file)
@@ -1,24 +1,16 @@
 /*
  * sapphire.h
  *
- * Copyright Mark Lord <mlord@pobox.com>, 2012-2015.
+ * Copyright Mark Lord <mlord@pobox.com>, 2012-2018.
  * http://rtr.ca/sapphire_remote/
  *
  * Button definitions shared with sapphire_keymap.sh
- * and the external glue driver.
+ * and other drivers which may use sapphire_relay().
  *
  * 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; specifically version 2 of the License (GPLv2).
  */
-#include <linux/device.h>
-#include <linux/hid.h>
-#include <linux/module.h>
-#include <linux/timer.h>
-#include <linux/kref.h>
-#include <linux/list.h>
-#include <linux/proc_fs.h>
-#include <linux/uaccess.h>
 
 /*
  * These enum's are shared with external keymaps and the sapphire_keymap.sh script:
@@ -76,59 +68,6 @@ enum {       /*
        SAPPHIRE_CLEAR          = 0x004c0000 , /* CLEAR          */
        SAPPHIRE_GREENMUSIC     = 0x00000804 , /* GREEN/MUSIC    */
 
-       /*
-        * A second set of "virtual" sapphire buttons,
-        * not for normal mapping use.  Instead, these are
-        * intended for use with the external "glue" module.
-        * If you don't know what that is, then just ignore these!
-        */
-       XAPPHIRE_UP             = 0x005200f0 , /* UP             */
-       XAPPHIRE_DOWN           = 0x005100f0 , /* DOWN           */
-       XAPPHIRE_RIGHT          = 0x004f00f0 , /* RIGHT          */
-       XAPPHIRE_LEFT           = 0x005000f0 , /* LEFT           */
-       XAPPHIRE_ENTEROK        = 0x002800f0 , /* ENTER/OK       */
-       XAPPHIRE_BACK           = 0x000400f3 , /* BACK           */
-       XAPPHIRE_PLAY           = 0x400000f3 , /* PLAY           */
-       XAPPHIRE_PAUSE          = 0x800000f3 , /* PAUSE          */
-       XAPPHIRE_VOLUP          = 0x000020f3 , /* VOL+           */
-       XAPPHIRE_VOLDOWN        = 0x000040f3 , /* VOL-           */
-       XAPPHIRE_CHUP           = 0x000100f3 , /* CH/PG+         */
-       XAPPHIRE_CHDOWN         = 0x000200f3 , /* CH/PG-         */
-       XAPPHIRE_MUTE           = 0x000010f3 , /* MUTE           */
-       XAPPHIRE_RECORD         = 0x000080f3 , /* RECORD         */
-       XAPPHIRE_FWD            = 0x080000f3 , /* FWD            */
-       XAPPHIRE_REW            = 0x040000f3 , /* REW            */
-       XAPPHIRE_ANGLE          = 0x000100f4 , /* ANGLE          */
-       XAPPHIRE_SAP            = 0x001000f4 , /* SAP            */
-       XAPPHIRE_DVDMENU        = 0x000400f4 , /* DVDMENU        */
-       XAPPHIRE_INFOEPG        = 0x020000f3 , /* INFO/EPG       */
-       XAPPHIRE_TAB            = 0x000001f3 , /* TAB            */
-       XAPPHIRE_BACKTAB        = 0x000002f3 , /* BACKTAB        */
-       XAPPHIRE_RADIO          = 0x000004f3 , /* RADIO          */
-       XAPPHIRE_LASTCH         = 0x004000f4 , /* LASTCH         */
-       XAPPHIRE_LANGUAGE       = 0x000200f4 , /* LANGUAGE       */
-       XAPPHIRE_TELETEXTCC     = 0x002000f4 , /* TELETEXT/CC    */
-       XAPPHIRE_SUBTITLE       = 0x000800f4 , /* SUBTITLE       */
-       XAPPHIRE_HOMEHOUSE      = 0x000001f4 , /* HOME (house)   */
-       XAPPHIRE_BLUEVIDEOS     = 0x000020f4 , /* BLUE/VIDEOS    */
-       XAPPHIRE_LIVETV         = 0x000002f4 , /* LIVETV         */
-       XAPPHIRE_REDDVDVCD      = 0x000080f4 , /* RED/DVD/VCD    */
-       XAPPHIRE_YELLOWPICTURES = 0x000010f4 , /* YELLOW/PICTURES*/
-       XAPPHIRE_1              = 0x001e00f0 , /* 1              */
-       XAPPHIRE_2              = 0x001f00f0 , /* 2              */
-       XAPPHIRE_3              = 0x002000f0 , /* 3              */
-       XAPPHIRE_4              = 0x002100f0 , /* 4              */
-       XAPPHIRE_5              = 0x002200f0 , /* 5              */
-       XAPPHIRE_6              = 0x002300f0 , /* 6              */
-       XAPPHIRE_7              = 0x002400f0 , /* 7              */
-       XAPPHIRE_8              = 0x002500f0 , /* 8              */
-       XAPPHIRE_9              = 0x002600f0 , /* 9              */
-       XAPPHIRE_0              = 0x002700f0 , /* 0              */
-       XAPPHIRE_STOP           = 0x001000f3 , /* STOP           */
-       XAPPHIRE_POWER          = 0x000002f2 , /* POWER          */
-       XAPPHIRE_CLEAR          = 0x004c00f0 , /* CLEAR          */
-       XAPPHIRE_GREENMUSIC     = 0x000008f4 , /* GREEN/MUSIC    */
-
        /*
         * Modifier buttons: "OR" these with "regular" KEY_ values as desired:
         */
similarity index 81%
rename from sapphire-remote-6.6/sapphire_startup.sh
rename to sapphire-remote-7.1/sapphire_startup.sh
index 96097fb1743f09a8dc14e785d6fca01170e68059..dc4f8f68a2b4ab885c60808d7965421702cfc815 100755 (executable)
@@ -26,15 +26,16 @@ fi
 # The workaround below seems to restore functionality.
 #
 cd $SAPPHIRE || exit 1
-dev="$(/bin/ls -1d [0-9]*[0-9A-F] 2>/dev/null | head -1)"
-if [ "$dev" != "" -a -e "$dev" ]; then
-       if cd -P "$dev/../.." ; then
-               if [ -e authorized ]; then
-                       echo 0 > authorized
-                       echo 1 > authorized
+for dev in [0-9]*[0-9A-F] ; do
+       if [ -e "$dev" ]; then
+               if cd -P "$dev/../.." ; then
+                       if [ -e authorized ]; then
+                               echo 0 > authorized
+                               echo 1 > authorized
+                       fi
+                       cd - >/dev/null
                fi
-               cd - >/dev/null
        fi
-fi
+done
 [ -e /etc/sapphire.keymap -a -x /usr/local/bin/sapphire_keymap.sh ] && /usr/local/bin/sapphire_keymap.sh
 exit 0