Skip to content

Commit fbd61a5

Browse files
committed
Expose the localOnly option to sane.get_devices()
1 parent 8c16d09 commit fbd61a5

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

CHANGES.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Version 2.8.0
2-
-----------
2+
-------------
33

44
- _sane.c:
55

@@ -14,6 +14,7 @@ Version 2.8.0
1414
- Make arr_snap return a 3D numpy array, shaped (samples, width, heigth)
1515
- Remove multipleOf support in arr_snap, this should be done by the caller
1616
- Overall cleanup
17+
- Expose the localOnly option to sane.get_devices()
1718

1819
- Documentation:
1920

_sane.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ PERFORMANCE OF THIS SOFTWARE.
4646
static PyObject *ErrorObject;
4747

4848
typedef struct {
49-
PyObject_HEAD
50-
SANE_Handle h;
49+
PyObject_HEAD
50+
SANE_Handle h;
5151
} SaneDevObject;
5252

5353
static PyTypeObject SaneDev_Type;
@@ -402,8 +402,6 @@ SaneDev_set_auto_option(SaneDevObject *self, PyObject *args)
402402
return Py_BuildValue("i", i);
403403
}
404404

405-
#define READSIZE 32768
406-
407405
static PyObject *
408406
SaneDev_snap(SaneDevObject *self, PyObject *args)
409407
{
@@ -482,7 +480,6 @@ SaneDev_snap(SaneDevObject *self, PyObject *args)
482480

483481
int imgBufOffset = imgBufCurLine * imgBytesPerLine;
484482
/* Copy data to image buffer */
485-
/* Recall: imgBytesPerLine = p.pixels_per_line * (p.format == SANE_FRAME_RGB ? 3 : 1); */
486483
if(p.format == SANE_FRAME_GRAY || p.format == SANE_FRAME_RGB)
487484
{
488485
if(p.depth == 1)
@@ -645,7 +642,7 @@ PySane_init(PyObject *self, PyObject *args)
645642

646643
return Py_BuildValue("iiii", version,
647644
SANE_VERSION_MAJOR(version),
648-
SANE_VERSION_MINOR(version),
645+
SANE_VERSION_MINOR(version),
649646
SANE_VERSION_BUILD(version));
650647
}
651648

sane.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,10 @@ def init():
355355
return _sane.init()
356356

357357

358-
def get_devices():
358+
def get_devices(localOnly=False):
359359
"""
360360
Return a list of 4-tuples containing the available scanning devices.
361+
If `localOnly` is `True`, only local devices will be returned.
361362
Each tuple is of the format ``(device_name, vendor, model, type)``, with:
362363
363364
* `device_name` -- The device name, suitable for passing to :func:`sane.open`.
@@ -369,7 +370,7 @@ def get_devices():
369370
:raises _sane.error: If an error occurs.
370371
371372
"""
372-
return _sane.get_devices()
373+
return _sane.get_devices(localOnly)
373374

374375

375376
def open(devname):

0 commit comments

Comments
 (0)