archrelease: copy trunk to extra-x86_64
[arch-packages.git] / libieee1284 / trunk / upstream_python_fix2.patch
blobe6926ce952621da7bfd3bf326a0958921e3e7b93
1 From b4d63327dfef8dbf12aabf4bba0f6818a3519995 Mon Sep 17 00:00:00 2001
2 From: Tim Waugh <twaugh@redhat.com>
3 Date: Tue, 8 Mar 2011 15:07:04 +0000
4 Subject: [PATCH] 2011-03-08 Tim Waugh <twaugh@redhat.com>
6 * src/ieee1284module.c: Added bindings for get_irq_fd and
7 clear_irq. Patch by Sergey Temerkhanov.
8 ---
9 ChangeLog | 5 +++++
10 src/ieee1284module.c | 33 +++++++++++++++++++++++++++++++++
11 2 files changed, 38 insertions(+)
13 diff --git a/src/ieee1284module.c b/src/ieee1284module.c
14 index 0093d6f..23c1f29 100644
15 --- a/src/ieee1284module.c
16 +++ b/src/ieee1284module.c
17 @@ -189,6 +189,33 @@ Parport_open (ParportObject *self, PyObject *args)
18 return PyInt_FromLong (capabilities);
21 +static PyObject *
22 +Parport_get_irq_fd (ParportObject *self)
24 + int fd = ieee1284_get_irq_fd (self->port);
25 + if (fd < 0) {
26 + handle_error (fd);
27 + return NULL;
28 + }
30 + return PyInt_FromLong (fd);
33 +static PyObject *
34 +Parport_clear_irq (ParportObject *self)
36 + int portcount = 0;
37 + int r;
39 + int fd = ieee1284_clear_irq (self->port, &portcount);
40 + if (r < 0) {
41 + handle_error (r);
42 + return NULL;
43 + }
45 + return PyInt_FromLong (portcount);
48 static PyObject *
49 Parport_close (ParportObject *self)
51 @@ -484,6 +511,12 @@ PyMethodDef Parport_methods[] = {
52 { "close", (PyCFunction) Parport_close, METH_NOARGS,
53 "close() -> None\n"
54 "Closes a port." },
55 + { "get_irq_fd", (PyCFunction) Parport_get_irq_fd, METH_VARARGS,
56 + "get_irq_fd() -> int\n"
57 + "Returns a pollable IRQ file descriptor." },
58 + { "clear_irq", (PyCFunction) Parport_clear_irq, METH_NOARGS,
59 + "clear_irq(portcount) -> int\n"
60 + "Clears IRQ and returns number of IRQs raised." },
61 { "claim", (PyCFunction) Parport_claim, METH_NOARGS,
62 "claim() -> None\n"
63 "Claims a port." },