Skip to content

Commit

Permalink
Imported tarball release 0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
tuomasjjrasanen committed Aug 29, 2012
1 parent f69ebff commit 1554d86
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 18 deletions.
6 changes: 6 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.9
===

- Python3 compatibility
- Python2.6 compatibility

0.8
===

Expand Down
9 changes: 6 additions & 3 deletions PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
Metadata-Version: 1.1
Name: python-uinput
Version: 0.8
Version: 0.9
Summary: Pythonic API to the Linux uinput kernel module.
Home-page: http://tjjr.fi/sw/python-uinput/
Author: Tuomas Jorma Juhani Räsänen
Author-email: [email protected]
License: GPLv3+
Download-URL: https://launchpad.net/python-uinput/trunk/0.8/+download/python-uinput-0.8.tar.gz
Download-URL: https://launchpad.net/python-uinput/trunk/0.9/+download/python-uinput-0.9.tar.gz
Description:
Python-uinput is Python interface to the Linux uinput kernel module
which allows attaching userspace device drivers into kernel.

Platform: Linux
Classifier: Development Status :: 3 - Alpha
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Operating System :: POSIX :: Linux
Classifier: Topic :: System :: Operating System Kernels :: Linux
Classifier: Programming Language :: Python :: 2.5
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
14 changes: 9 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-

from __future__ import with_statement
from __future__ import print_function
import re

from distutils.command.build_py import build_py as _build_py
Expand All @@ -11,7 +12,7 @@ def append_ev(ev_type, ev_name):
for line in f:
match = re.match(r"^#define (" + ev_name + "_.*)\t+((?:0x[0-9a-f]+)|(?:\d+))", line)
if match:
print >>f2, "%s = (%s, %s)" % (match.group(1).strip(), ev_type, match.group(2).strip())
print("%s = (%s, %s)" % (match.group(1).strip(), ev_type, match.group(2).strip()), file=f2)

class build_py(_build_py):

Expand All @@ -23,7 +24,7 @@ def run(self):
_build_py.run(self)

setup(name='python-uinput',
version='0.8',
version='0.9',
description='Pythonic API to the Linux uinput kernel module.',
author='Tuomas Jorma Juhani Räsänen',
author_email='[email protected]',
Expand All @@ -32,16 +33,19 @@ def run(self):
packages=['uinput'],
license='GPLv3+',
platforms=['Linux'],
download_url='https://launchpad.net/python-uinput/trunk/0.8/+download/python-uinput-0.8.tar.gz',
download_url='https://launchpad.net/python-uinput/trunk/0.9/+download/python-uinput-0.9.tar.gz',
classifiers=[
"Development Status :: 3 - Alpha",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License (GPL)",
"Operating System :: POSIX :: Linux",
"Topic :: System :: Operating System Kernels :: Linux",
"Programming Language :: Python :: 2.5",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.1",
"Programming Language :: Python :: 3.2",
],
long_description="""
Python-uinput is Python interface to the Linux uinput kernel module
Expand Down
22 changes: 12 additions & 10 deletions src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import ctypes
import os
import distutils.sysconfig as sysconfig

from .ev import *

Expand Down Expand Up @@ -66,7 +67,7 @@ def _error_handler(result, fn, args):
raise RuntimeError("unexpected return value: %s" % result)
return result

_libsuinput_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "_libsuinput.so"))
_libsuinput_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "_libsuinput" + sysconfig.get_config_var("SO")))
_libsuinput = ctypes.CDLL(_libsuinput_path, use_errno=True)
_libsuinput.suinput_open.errcheck = _error_handler
_libsuinput.suinput_enable_event.errcheck = _error_handler
Expand Down Expand Up @@ -96,9 +97,10 @@ class Device(object):
def __init__(self, events, name="python-uinput",
bustype=0, vendor=0, product=0, version=0):
self.__events = events
self.__name = name
self.__uinput_fd = -1
self.__name = name.encode()

user_dev = _struct_uinput_user_dev(name)
user_dev = _struct_uinput_user_dev(self.__name)
user_dev.id.bustype = bustype
user_dev.id.vendor = vendor
user_dev.id.product = product
Expand All @@ -125,8 +127,8 @@ def syn(self):
example sending REL_X and REL_Y atomically requires to emit
first event without syn and the second with syn::
d.emit(uinput.EV_REL, uinput.REL_X, 1, syn=False)
d.emit(uinput.EV_REL, uinput.REL_Y, 1)
d.emit(uinput.REL_X, 1, syn=False)
d.emit(uinput.REL_Y, 1)
The call above appears as a single (+1, +1) event.
"""
Expand All @@ -136,12 +138,12 @@ def syn(self):
def emit(self, event, value, syn=True):
"""Emit event.
`event` - type-code -pair, for example (uinput.EV_REL, uinput.REL_X)
`event` - event identifier, for example uinput.REL_X
`value` - value of the event type:
EV_KEY/EV_BTN: 1 (key-press) or 0 (key-release)
EV_REL : integer value of the relative change
EV_ABS : integer value in the range of min and max values
`value` - value of the event
KEY/BTN : 1 (key-press) or 0 (key-release)
REL : integer value of the relative change
ABS : integer value in the range of min and max values
`syn` - If True, Device.syn(self) will be called before return.
"""
Expand Down

0 comments on commit 1554d86

Please sign in to comment.