Update of /cvsroot/freevo/freevo/WIP/RobShortt/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29343
Added Files:
evdev.py
Log Message:
Event input device support. A work in progress / proof of concept. With this
we can totally bypass lirc if there's an event input driver for a given
remote.
--- NEW FILE: evdev.py ---
#if 0 /*
# -----------------------------------------------------------------------
# evdev.py - An event device (/dev/input/eventX) plugin for Freevo.
# -----------------------------------------------------------------------
# $Id: evdev.py,v 1.1 2004/09/01 17:36:43 rshortt Exp $
#
# Notes:
#
# -----------------------------------------------------------------------
# $Log: evdev.py,v $
# Revision 1.1 2004/09/01 17:36:43 rshortt
# Event input device support. A work in progress / proof of concept. With this
# we can totally bypass lirc if there's an event input driver for a given
# remote.
#
#
#
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2003 Krister Lagerstrom, et al.
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
#
# 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; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# ----------------------------------------------------------------------- */
#endif
import sys
import os
import select
import struct
import traceback
from time import sleep
import config
import plugin
import rc
rc = rc.get_singleton()
class PluginInterface(plugin.DaemonPlugin):
def __init__(self, device_name=None):
plugin.DaemonPlugin.__init__(self)
self.plugin_name = 'EVDEV'
self.device_name = device_name
self.poll_interval = 0
if not self.device_name:
print 'Input device plugin disabled, exiting.'
return
try:
self.fd = os.open(self.device_name,
os.O_RDONLY|os.O_NONBLOCK)
except OSError:
print 'Unable to open %s, exiting.' % self.device_name
return
print 'Using input device %s.', self.device_name
self.poll_interval = 1
self.poll_menu_only = False
def poll(self):
command = ''
# _debug_('self.fd = %s' % self.fd, level=3)
(r, w, e) = select.select([self.fd], [], [], 0)
# _debug_('r,w,e = %s,%s,%s' % (r,w,e), level=3)
if r:
c = os.read(self.fd, 1024)
print 'RLS: got stuff from event device'
else:
return
#struct input_event {
# struct timeval time;
# __u16 type;
# __u16 code;
# __s32 value;
#};
#struct timeval {
# time_t tv_sec; /* seconds */ long
# suseconds_t tv_usec; /* microseconds */ long
#};
S_EVDATA = '2l2Hi'
data = struct.unpack(S_EVDATA, c)
print ' time: %s' % data[0]
print ' type: %s' % data[2]
print ' code: %s' % data[3]
print ' value: %s' % data[4]
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog