hplip-device-reconnected.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. diff -up hplip-3.9.10/prnt/backend/hp.c.device-reconnected hplip-3.9.10/prnt/backend/hp.c
  2. --- hplip-3.9.10/prnt/backend/hp.c.device-reconnected 2009-11-03 21:45:10.000000000 +0000
  3. +++ hplip-3.9.10/prnt/backend/hp.c 2009-11-04 16:25:30.719129509 +0000
  4. @@ -645,6 +645,7 @@ int main(int argc, char *argv[])
  5. HPMUD_DEVICE hd=-1;
  6. HPMUD_CHANNEL cd=-1;
  7. int n, total=0, retry=0, size, pages;
  8. + int consecutive_failures=0;
  9. enum HPMUD_RESULT stat;
  10. char *printer = getenv("PRINTER");
  11. @@ -809,11 +810,24 @@ int main(int argc, char *argv[])
  12. {
  13. exit_stat = BACKEND_STOP; /* stop queue */
  14. goto bugout;
  15. + }
  16. +
  17. + if (++consecutive_failures == 5)
  18. + {
  19. + /* hpmud_write_channel has failed several times in
  20. + * succession but the Device ID-based status says
  21. + * the printer is happy. Time to face the fact that
  22. + * the device has probably reconnected, and our USB
  23. + * channel is invalidated. */
  24. +
  25. + BUG("ERROR: device reconnected?");
  26. + goto bugout;
  27. }
  28. }
  29. else
  30. {
  31. /* Data was sent to device successfully. */
  32. + consecutive_failures = 0;
  33. if (pa.pjl_device)
  34. {
  35. /* Laserjets have a large data buffer, so manually check for operator intervention condition. */