Skip to content

Commit

Permalink
Only dump scan settings before first page
Browse files Browse the repository at this point in the history
  • Loading branch information
SimulPiscator committed Feb 10, 2024
1 parent a6db8c3 commit c5d3a4a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion basic/fdbuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fdbuf::fdbuf(int fd, int putback)

fdbuf::~fdbuf()
{
sync();
fdbuf::sync();
::close(mFd);
}

Expand Down
10 changes: 8 additions & 2 deletions sanecpp/sanecpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,6 @@ session::~session()
session&
session::start()
{
log << "sane_start(" << m_device.get() << ") with options:" << m_options
<< std::endl;
m_status = ::sane_start(m_device.get());
switch (m_status) {
case SANE_STATUS_GOOD:
Expand Down Expand Up @@ -610,6 +608,14 @@ session::read(std::vector<char>& buffer)
return *this;
}

const session&
session::dump_options() const
{
log << "session " << m_device.get() << " options:" << m_options
<< std::endl;
return *this;
}

void
session::init()
{
Expand Down
1 change: 1 addition & 0 deletions sanecpp/sanecpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class session
session& start();
session& cancel();
session& read(std::vector<char>&);
const session& dump_options() const;

private:
void init();
Expand Down
8 changes: 5 additions & 3 deletions server/scanjob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,10 +572,12 @@ ScanJob::Private::beginTransfer()
if(!atomicTransition(pending, processing))
return false;
bool ok = true;
if (!mpSession)
if (!mpSession) {
ok = (openSession() == SANE_STATUS_GOOD);
if (ok)
startSession();
if (ok)
mpSession->dump_options();
}
startSession();
ok = isProcessing();
if (!ok)
closeSession();
Expand Down

0 comments on commit c5d3a4a

Please sign in to comment.