+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
-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
DEB_NAME=sapphire-remote
NAME=sapphire-remote
-VERSION=6.6
+VERSION=7.1
configure: configure-stamp
configure-stamp:
#
# Makefile and (un-)Installer for Sapphire remote control driver,
-# by Mark Lord 2012-2015.
+# by Mark Lord 2012-2018.
#
MODNAME=sapphire
MODSOURCE=$(MODNAME).c
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 ;\
-PACKAGE_VERSION="6.6"
+PACKAGE_VERSION="7.1"
# Items below here should not have to change with each driver version
PACKAGE_NAME="sapphire-remote"
/*
* 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
#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,
* 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 */
/* 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;
/*
* 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;
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.
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,
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) */
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);
*/
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
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) {
/*
* 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:
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:
*/
# 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