mirror of
git://slackware.nl/current.git
synced 2024-12-29 10:25:00 +01:00
63 lines
1.7 KiB
Diff
63 lines
1.7 KiB
Diff
|
From b4d63327dfef8dbf12aabf4bba0f6818a3519995 Mon Sep 17 00:00:00 2001
|
||
|
From: Tim Waugh <twaugh@redhat.com>
|
||
|
Date: Tue, 8 Mar 2011 15:07:04 +0000
|
||
|
Subject: [PATCH] 2011-03-08 Tim Waugh <twaugh@redhat.com>
|
||
|
|
||
|
* src/ieee1284module.c: Added bindings for get_irq_fd and
|
||
|
clear_irq. Patch by Sergey Temerkhanov.
|
||
|
---
|
||
|
src/ieee1284module.c | 33 +++++++++++++++++++++++++++++++++
|
||
|
2 files changed, 38 insertions(+)
|
||
|
|
||
|
diff --git a/src/ieee1284module.c b/src/ieee1284module.c
|
||
|
index 0093d6f..23c1f29 100644
|
||
|
--- a/src/ieee1284module.c
|
||
|
+++ b/src/ieee1284module.c
|
||
|
@@ -189,6 +189,33 @@ Parport_open (ParportObject *self, PyObject *args)
|
||
|
return PyInt_FromLong (capabilities);
|
||
|
}
|
||
|
|
||
|
+static PyObject *
|
||
|
+Parport_get_irq_fd (ParportObject *self)
|
||
|
+{
|
||
|
+ int fd = ieee1284_get_irq_fd (self->port);
|
||
|
+ if (fd < 0) {
|
||
|
+ handle_error (fd);
|
||
|
+ return NULL;
|
||
|
+ }
|
||
|
+
|
||
|
+ return PyInt_FromLong (fd);
|
||
|
+}
|
||
|
+
|
||
|
+static PyObject *
|
||
|
+Parport_clear_irq (ParportObject *self)
|
||
|
+{
|
||
|
+ int portcount = 0;
|
||
|
+ int r;
|
||
|
+
|
||
|
+ int fd = ieee1284_clear_irq (self->port, &portcount);
|
||
|
+ if (r < 0) {
|
||
|
+ handle_error (r);
|
||
|
+ return NULL;
|
||
|
+ }
|
||
|
+
|
||
|
+ return PyInt_FromLong (portcount);
|
||
|
+}
|
||
|
+
|
||
|
static PyObject *
|
||
|
Parport_close (ParportObject *self)
|
||
|
{
|
||
|
@@ -484,6 +511,12 @@ PyMethodDef Parport_methods[] = {
|
||
|
{ "close", (PyCFunction) Parport_close, METH_NOARGS,
|
||
|
"close() -> None\n"
|
||
|
"Closes a port." },
|
||
|
+ { "get_irq_fd", (PyCFunction) Parport_get_irq_fd, METH_VARARGS,
|
||
|
+ "get_irq_fd() -> int\n"
|
||
|
+ "Returns a pollable IRQ file descriptor." },
|
||
|
+ { "clear_irq", (PyCFunction) Parport_clear_irq, METH_NOARGS,
|
||
|
+ "clear_irq(portcount) -> int\n"
|
||
|
+ "Clears IRQ and returns number of IRQs raised." },
|
||
|
{ "claim", (PyCFunction) Parport_claim, METH_NOARGS,
|
||
|
"claim() -> None\n"
|
||
|
"Claims a port." },
|