You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
5.2 KiB

  1. Index: hplip-3.20.9/Makefile.am
  2. ===================================================================
  3. --- hplip-3.20.9.orig/Makefile.am
  4. +++ hplip-3.20.9/Makefile.am
  5. @@ -71,7 +71,7 @@ else
  6. libsane_hpaio_la_LDFLAGS = -version-info 1:0:0
  7. endif
  8. # The following is a interlibrary dependency that must be compiled first.
  9. -libsane_hpaio_la_LIBADD = libhpip.la libhpmud.la libhpipp.la $(DBUS_LIBS) -lcups -ldl
  10. +libsane_hpaio_la_LIBADD = libhpip.la libhpmud.la libhpipp.la $(DBUS_LIBS) -ldl
  11. #libsane_hpaio_la_CFLAGS = -DWITH_NONAMESPACES -DSOAP_DEBUG
  12. libsane_hpaio_la_CFLAGS = $(DBUS_CFLAGS) -Iprotocol
  13. Index: hplip-3.20.9/scan/sane/hpaio.c
  14. ===================================================================
  15. --- hplip-3.20.9.orig/scan/sane/hpaio.c
  16. +++ hplip-3.20.9/scan/sane/hpaio.c
  17. @@ -34,9 +34,7 @@
  18. #include <stdio.h>
  19. #include <stdlib.h>
  20. #include <string.h>
  21. -#include <cups/cups.h>
  22. #include "hpmud.h"
  23. -#include "avahiDiscovery.h"
  24. #include "hp_ipp.h"
  25. #include "soap.h"
  26. #include "soapht.h"
  27. @@ -146,98 +144,6 @@ static int GetUriLine(char *buf, char *u
  28. return i;
  29. }
  30. -static int AddCupsList(char *uri, char ***printer)
  31. -{
  32. - int i, stat=1;
  33. -
  34. - /* Look for hp network URIs only. */
  35. - if (strncasecmp(uri, "hp:/net/", 8) !=0)
  36. - goto bugout;
  37. -
  38. - if (*printer == NULL)
  39. - {
  40. - /* Allocate array of string pointers. */
  41. - *printer = malloc(sizeof(char *) * MAX_DEVICE);
  42. - memset(*printer, 0, sizeof(char *) * MAX_DEVICE);
  43. - }
  44. -
  45. - /* Ignor duplicates (ie: printer queues using the same device). */
  46. - for (i=0; (*printer)[i] != NULL && i<MAX_DEVICE; i++)
  47. - {
  48. - if (strcmp((*printer)[i], uri) == 0)
  49. - goto bugout;
  50. - }
  51. -
  52. - /* Find empty slot in array of pointers. */
  53. - for (i=0; i<MAX_DEVICE; i++)
  54. - {
  55. - if ((*printer)[i] == NULL)
  56. - {
  57. - (*printer)[i] = strdup(uri);
  58. - break;
  59. - }
  60. - }
  61. -
  62. - stat = 0;
  63. -
  64. -bugout:
  65. -
  66. - return stat;
  67. -}
  68. -
  69. -
  70. -static int GetCupsPrinters(char ***printer)
  71. -{
  72. - http_t *http=NULL; /* HTTP object */
  73. - ipp_t *request=NULL; /* IPP request object */
  74. - ipp_t *response=NULL; /* IPP response object */
  75. - ipp_attribute_t *attr; /* Current IPP attribute */
  76. - int cnt=0;
  77. -
  78. - /* Connect to the HTTP server */
  79. - if ((http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption())) == NULL)
  80. - goto bugout;
  81. -
  82. - /* Assemble the IPP request */
  83. - request = ippNew();
  84. -
  85. - ippSetOperation( request, CUPS_GET_PRINTERS );
  86. - ippSetRequestId( request, 1 );
  87. -
  88. - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, "attributes-charset", NULL, "utf-8");
  89. - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, "en");
  90. - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", NULL, "device-uri");
  91. -
  92. - /* Send the request and get a response. */
  93. - if ((response = cupsDoRequest(http, request, "/")) == NULL)
  94. - goto bugout;
  95. -
  96. - for (attr = ippFirstAttribute ( response ); attr != NULL; attr = ippNextAttribute( response ))
  97. - {
  98. - /* Skip leading attributes until we hit a printer. */
  99. - while (attr != NULL && ippGetGroupTag( attr ) != IPP_TAG_PRINTER)
  100. - attr = ippNextAttribute( response );
  101. -
  102. - if (attr == NULL)
  103. - break;
  104. -
  105. - while (attr != NULL && ippGetGroupTag( attr ) == IPP_TAG_PRINTER)
  106. - {
  107. - if (strcmp(ippGetName( attr ), "device-uri") == 0 && ippGetValueTag( attr ) == IPP_TAG_URI && AddCupsList(ippGetString( attr, 0, NULL ), printer) == 0)
  108. - cnt++;
  109. - attr = ippNextAttribute( response );
  110. - }
  111. -
  112. - if (attr == NULL)
  113. - break;
  114. - }
  115. -
  116. - ippDelete(response);
  117. -
  118. - bugout:
  119. - return cnt;
  120. -}
  121. -
  122. static int AddDevice(char *uri)
  123. {
  124. struct hpmud_model_attributes ma;
  125. @@ -290,7 +196,6 @@ static int DevDiscovery(int localOnly)
  126. char uri[HPMUD_LINE_SIZE];
  127. char *tail = message;
  128. int i, scan_type, cnt=0, total=0, bytes_read;
  129. - char **cups_printer=NULL; /* list of printers */
  130. char* token = NULL;
  131. enum HPMUD_RESULT stat;
  132. @@ -305,39 +210,6 @@ static int DevDiscovery(int localOnly)
  133. total += AddDevice(uri);
  134. }
  135. //memset(message, 0, sizeof(message));
  136. - /* Look for Network Scan devices if localonly flag if FALSE. */
  137. - if (!localOnly)
  138. - {
  139. - /* Look for all-in-one scan devices for which print queue created */
  140. - cnt = GetCupsPrinters(&cups_printer);
  141. - for (i=0; i<cnt; i++)
  142. - {
  143. - total += AddDevice(cups_printer[i]);
  144. - free(cups_printer[i]);
  145. - }
  146. - if (cups_printer)
  147. - free(cups_printer);
  148. -#ifdef HAVE_LIBNETSNMP
  149. - /* Discover NW scanners using Bonjour*/
  150. - //bytes_read = avahi_probe_nw_scanners();
  151. - if( (avahi_probe_nw_scanners() == AVAHI_STATUS_OK) && (aUriBuf != NULL) )
  152. - {
  153. - token = strtok(aUriBuf, ";");
  154. - while (token)
  155. - {
  156. - total += AddDevice(token);
  157. - token = strtok(NULL, ";");
  158. - }
  159. - free(aUriBuf);
  160. - aUriBuf = NULL;
  161. - }
  162. -#endif
  163. - if(!total)
  164. - {
  165. - SendScanEvent("hpaio:/net/HP_Scan_Devices?ip=1.1.1.1", EVENT_ERROR_NO_PROBED_DEVICES_FOUND);
  166. - }
  167. - }
  168. -
  169. bugout:
  170. return total;
  171. }