discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Exclusive ownership of knob or HID devices (powermate


From: Krzysztof Kamieniecki
Subject: [Discuss-gnuradio] Exclusive ownership of knob or HID devices (powermate.py)
Date: Wed, 03 Aug 2005 22:45:30 -0400
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511

While lurking on the Kino developers mailing list, they seem to be the most active users of hardware knobs, I can across the EVIOCGRAB ioctl which will exclusively grab an input device. This can be used to temporarily prevent X (under in Linux 2.6 at least) from receiving any messages from a specific device.

Attached is a patch for "powermate.py". I don't know how it will work on other systems, but it works great for me.

Enjoy,
Krys
--
Krzysztof Kamieniecki
callsign:KB1KLB
mailto:address@hidden

Index: src/python/powermate.py
===================================================================
RCS file: /cvsroot/gnuradio/gr-wxgui/src/python/powermate.py,v
retrieving revision 1.5
diff -u -r1.5 powermate.py
--- src/python/powermate.py     9 Jun 2005 21:25:36 -0000       1.5
+++ src/python/powermate.py     28 Jul 2005 03:28:32 -0000
@@ -207,6 +207,11 @@
                 os.close(self.handle)
                 self.handle = -1
                 return False
+
+            # get exclusive control of the device, using ioctl EVIOCGRAB
+           # there may be an issue with this on non x86 platforms and if
+           # the _IOW,_IOC,... macros in <asm/ioctl.h> are changed
+            fcntl.ioctl(self.handle,gru.hexint(0x40044590), 1)
             return True
         except exceptions.OSError:
             return False

reply via email to

[Prev in Thread] Current Thread [Next in Thread]