kopia lustrzana https://gitlab.com/sane-project/backends
portabilty mods to epson2 backend
No behavior changes. Wrap some optional headers with #ifdef's and use usleep() instead of sleep() since it exist everywhere.merge-requests/1/head
rodzic
ba10bb37cd
commit
50475719ef
|
@ -20,9 +20,9 @@
|
|||
#include "sane/config.h"
|
||||
|
||||
#include <unistd.h> /* sleep */
|
||||
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include "byteorder.h"
|
||||
|
||||
|
@ -1439,7 +1439,7 @@ e2_wait_button(Epson_Scanner * s)
|
|||
if (button_status)
|
||||
s->hw->wait_for_button = SANE_FALSE;
|
||||
else
|
||||
sleep(1);
|
||||
usleep(1000);
|
||||
} else {
|
||||
/* we run into an error condition, just continue */
|
||||
s->hw->wait_for_button = SANE_FALSE;
|
||||
|
@ -1533,7 +1533,7 @@ e2_wait_warm_up(Epson_Scanner * s)
|
|||
s->retry_count);
|
||||
return SANE_STATUS_DEVICE_BUSY;
|
||||
}
|
||||
sleep(5);
|
||||
usleep(5000);
|
||||
}
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
|
@ -1816,7 +1816,7 @@ read_info_block(Epson_Scanner * s, EpsonDataRec * result)
|
|||
if (ext_status[0] & EXT_STATUS_WU) {
|
||||
free(ext_status);
|
||||
|
||||
sleep(5); /* for the next attempt */
|
||||
usleep(5000); /* for the next attempt */
|
||||
|
||||
DBG(1, "retrying ESC G - %d\n", ++(s->retry_count));
|
||||
|
||||
|
|
|
@ -389,8 +389,6 @@ e2_network_discovery(void)
|
|||
|
||||
struct timeval to;
|
||||
|
||||
long save_flags, flags;
|
||||
|
||||
status = sanei_udp_open_broadcast(&fd);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return;
|
||||
|
@ -405,9 +403,7 @@ e2_network_discovery(void)
|
|||
FD_ZERO(&rfds);
|
||||
FD_SET(fd, &rfds);
|
||||
|
||||
save_flags = flags = fcntl(fd, F_GETFL, 0L);
|
||||
flags |= O_NONBLOCK;
|
||||
fcntl(fd, F_SETFL, flags);
|
||||
sanei_udp_set_nonblock(fd, SANE_TRUE);
|
||||
if (select(fd + 1, &rfds, NULL, NULL, &to) > 0) {
|
||||
while ((len = sanei_udp_recvfrom(fd, buf, 76, &ip)) == 76) {
|
||||
DBG(5, " response from %s\n", ip);
|
||||
|
@ -417,7 +413,6 @@ e2_network_discovery(void)
|
|||
attach_one_net(ip);
|
||||
}
|
||||
}
|
||||
fcntl(fd, F_SETFL, save_flags);
|
||||
|
||||
DBG(5, "%s, end\n", __func__);
|
||||
|
||||
|
@ -650,7 +645,7 @@ device_detect(const char *name, int type, SANE_Status *status)
|
|||
* sleep a bit.
|
||||
*/
|
||||
if (dev->connection == SANE_EPSON_NET)
|
||||
sleep(1);
|
||||
usleep(1000);
|
||||
|
||||
return scanner_create(dev, status);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
#define BACKEND_NAME epson2
|
||||
#define DEBUG_NOT_STATIC
|
||||
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDDEF_H
|
||||
#include <stddef.h>
|
||||
|
|
Ładowanie…
Reference in New Issue