diff options
Diffstat (limited to 'backend/gt68xx_low.c')
| -rw-r--r-- | backend/gt68xx_low.c | 24 | 
1 files changed, 19 insertions, 5 deletions
| diff --git a/backend/gt68xx_low.c b/backend/gt68xx_low.c index 3ea4590..5aa84ac 100644 --- a/backend/gt68xx_low.c +++ b/backend/gt68xx_low.c @@ -16,9 +16,7 @@     General Public License for more details.     You should have received a copy of the GNU General Public License -   along with this program; if not, write to the Free Software -   Foundation, Inc., 59 Temple Place - Suite 330, Boston, -   MA 02111-1307, USA. +   along with this program.  If not, see <https://www.gnu.org/licenses/>.     As a special exception, the authors of SANE give permission for     additional uses of the libraries contained in this release of SANE. @@ -176,6 +174,8 @@ gt68xx_device_new (GT68xx_Device ** dev_return)    dev->manual_selection = SANE_FALSE; +  dev->scan_started = SANE_FALSE; +  #ifdef USE_FORK    dev->shm_channel = NULL;  #endif /* USE_FORK */ @@ -626,7 +626,14 @@ gt68xx_device_start_scan (GT68xx_Device * dev)  {    CHECK_DEV_ACTIVE (dev, "gt68xx_device_start_scan");    if (dev->model->command_set->start_scan) -    return (*dev->model->command_set->start_scan) (dev); +    { +      if (!dev->scan_started) +        { +          dev->scan_started = SANE_TRUE; +          return (*dev->model->command_set->start_scan) (dev); +        } +      return SANE_STATUS_DEVICE_BUSY; +    }    else      return SANE_STATUS_UNSUPPORTED;  } @@ -681,7 +688,14 @@ gt68xx_device_stop_scan (GT68xx_Device * dev)  {    CHECK_DEV_ACTIVE (dev, "gt68xx_device_stop_scan");    if (dev->model->command_set->stop_scan) -    return (*dev->model->command_set->stop_scan) (dev); +    { +      if (dev->scan_started) +        { +          dev->scan_started = SANE_FALSE; +          return (*dev->model->command_set->stop_scan) (dev); +        } +      return SANE_STATUS_GOOD;  // Essentially a NOP. +    }    else      return SANE_STATUS_UNSUPPORTED;  } | 
