packages/libs/libinklevel/patches/002-disable_parport.patch
florian d8232d1e79 Add libinklevel (#4335), thanks Raphael
git-svn-id: svn://svn.openwrt.org/openwrt/packages@13614 3c298f89-4303-0410-b956-a3cf2f4a3e73
2008-12-12 14:51:12 +00:00

53 lines
1.5 KiB
Diff

--- libinklevel-0.7.3.orig/linux.c 2008-12-10 17:09:05.052017664 +0100
+++ libinklevel-0.7.3/linux.c 2008-12-10 17:19:59.362144646 +0100
@@ -8,7 +8,9 @@
#include "inklevel.h"
+#ifdef WITH_PARPORT
#include <ieee1284.h>
+#endif
#include <stdio.h>
#include <sys/types.h>
@@ -30,7 +32,9 @@ int open_printer_device(const int port,
int get_device_id(const int port, const char *device_file,
const int portnumber, char *device_id) {
+#ifdef WITH_PARPORT
struct parport_list parports;
+#endif
char tmp[BUFLEN];
char device_file1[256];
char device_file2[256];
@@ -39,6 +43,7 @@ int get_device_id(const int port, const
char *c;
int realsize;
+#ifdef WITH_PARPORT
if (port == PARPORT ) {
/* check if we have appropiate permissions */
@@ -71,7 +76,9 @@ int get_device_id(const int port, const
return COULD_NOT_GET_DEVICE_ID;
- } else if (port == USB || port == CUSTOM_USB) {
+ } else
+#endif
+ if (port == USB || port == CUSTOM_USB) {
if (port == USB) {
sprintf(device_file1, "/dev/usb/lp%d", portnumber);
@@ -132,8 +139,10 @@ int open_printer_device(const int port,
if (port == USB) {
sprintf(device_file1, "/dev/usb/lp%d", portnumber);
sprintf(device_file2, "/dev/usblp%d", portnumber);
+#ifdef WITH_PARPORT
} else if (port == PARPORT) {
sprintf(device_file1, "/dev/lp%d", portnumber);
+#endif
} else if (port == CUSTOM_USB) {
strncpy(device_file1, device_file, 255);
device_file1[255] = '\0';