### USB Endpoint and Device Descriptor Examples Source: http://sane-project.org/unsupported/canon-pixma-mp780.html Raw output examples showing USB endpoint configuration and device qualifier details for hardware identification. ```text Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x89 EP 9 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 bNumConfigurations 1 ``` -------------------------------- ### HP Backend Configuration Example Source: http://sane-project.org/man/sane-hp.5.html This is a sample configuration file for the SANE HP backend. Empty lines and lines starting with '#' are ignored. Options before the first device name apply as defaults, while options below a device name apply only to that specific device. ```config /dev/scanner # this is a comment /dev/hpscan option connect-device ``` -------------------------------- ### Sample mustek_pp.conf Configuration Source: http://sane-project.org/man/sane-mustek_pp.5.html A complete example showing device definitions and associated calibration options. ```text # # LifeTec/Medion 9350 on port 0x378 # scanner "LifeTec 9350" 0x378 cis1200 # Some calibration options (examples!). option bw 127 option top_skip -0.8 # # A Mustek 600CP on port 0x3BC # scanner "Mustek 600CP" 0x3BC cis600 # Some calibration options (examples!). option bw 120 ``` -------------------------------- ### Launch xcam with buffer size Source: http://sane-project.org/man/sane-stv680.5.html Start the xcam frontend with the required buffer size option. ```bash xcam -B ``` -------------------------------- ### Sample Microtek2 Configuration Source: http://sane-project.org/man/sane-microtek2.5.html A basic example showing global options, device definitions, and comments. ```text option dump 1 option strip-height 1.0 /dev/scanner option no-backtrack-option on # this is a comment /dev/sge option lightlid-35 on ``` -------------------------------- ### Verify SANE Installation with Test Backend Source: http://sane-project.org/man/sane.7.html Use the test backend to confirm that SANE libraries are installed and functioning correctly. ```bash scanimage -d test -T ``` -------------------------------- ### SANE Start Source: http://sane-project.org/sanei/sanei__backend_8h.html Starts the SANE acquisition process. ```APIDOC ## start() ### Description Starts the SANE acquisition process. ### Method N/A (Function Signature) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **SANE_Status** - Status of the operation. #### Response Example N/A ``` -------------------------------- ### Scan ADF Command Line Example Source: http://sane-project.org/man/sane-matsushita.5.html Example of using the scanadf command-line tool to scan documents from the feeder. Ensure the device name and output file format are correctly specified. ```bash scanadf -d matsushita --output-file scan%04d.pbm --start-count 0 --du- plex --resolution 300 --feeder-mode="All pages" --paper-size="A4" ``` -------------------------------- ### Example Usage of DBG Macro Source: http://sane-project.org/sanei/sanei__debug_8h.html An example demonstrating how to use the DBG macro to print a message indicating the opening of a file descriptor. ```c DBG(1, "sane_open: opening fd %d\n", fd) ``` -------------------------------- ### Configure devfs Permissions Source: http://sane-project.org/man/sane-scsi.5.html Example configuration lines for /etc/devfs/perms to manage device access permissions. ```text REGISTER ^sg[^/]* PERMISSIONS root.root 0600 ``` ```text REGISTER ^sg4 PERMISSIONS root.scanner 0660 ``` -------------------------------- ### List Available Devices Source: http://sane-project.org/man/sane-coolscan3.5.html Use this command to list all devices recognized by your SANE installation. ```bash scanimage -L ``` -------------------------------- ### Apply GPL copyright notice to source files Source: http://sane-project.org/COPYING Attach this notice to the start of each source file to convey the exclusion of warranty and licensing terms. ```text Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 ``` -------------------------------- ### SANE Get Select FD Source: http://sane-project.org/sanei/sanei__backend_8h.html Gets the file descriptor for SANE select. ```APIDOC ## get_select_fd() ### Description Gets the file descriptor for SANE select. ### Method N/A (Function Signature) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **SANE_Int*** (pointer) - Pointer to the file descriptor. #### Response Example N/A ``` -------------------------------- ### void sanei_codec_bin_init(Wire *w) Source: http://sane-project.org/sanei/sanei__codec__bin_8h.html Initializes the binary codec by setting the I/O functions of the provided Wire object. ```APIDOC ## void sanei_codec_bin_init(Wire *w) ### Description Initialize the binary codec. This function sets the I/O functions of the Wire to those of the binary codec, enabling data translation to a byte stream while accounting for byte order. ### Parameters #### Path Parameters - **w** (Wire*) - Required - The Wire object to initialize with binary codec I/O functions. ``` -------------------------------- ### void sanei_access_init(const char *backend) Source: http://sane-project.org/sanei/sanei__access_8h.html Initializes the sanei_access library. This must be called before any other function in the library. ```APIDOC ## void sanei_access_init() ### Description Initializes the sanei_access library. This function must be called before any other sanei_access function. ### Parameters #### Path Parameters - **backend** (const char *) - Required - The name of the backend using this library. ``` -------------------------------- ### SANE Start Function Signature Source: http://sane-project.org/sanei/sanei__wire_8h_source.html The signature for the SANE start function, used to initiate a SANE operation. It takes a SANE handle as input. ```c SANE_Status ENTRY() start(SANE_Handle) ``` -------------------------------- ### List help options for stv680 Source: http://sane-project.org/man/sane-stv680.5.html Display available command line options for the stv680 backend. ```bash scanimage --help -d stv680 ``` -------------------------------- ### Set Batch Scan Start Page Source: http://sane-project.org/man/scanimage.1.html The --batch-start option defines the starting page number for naming files in batch mode. If not specified, the counter begins at 1. ```bash scanimage --batch-start=5 ``` -------------------------------- ### Display available options Source: http://sane-project.org/man/scanimage.1.html Lists all command-line options supported by the current device. ```bash scanimage -h ``` -------------------------------- ### Sample gt68xx.conf Configuration Source: http://sane-project.org/man/sane-gt68xx.5.html This sample configuration demonstrates how to specify USB device IDs, override default parameters, set firmware paths, define vendor and model information, and configure Analog FrontEnd (AFE) settings for the gt68xx SANE backend. ```config usb 0x05d8 0x4002 override "mustek-scanexpress-1200-ub-plus" firmware "/opt/gt68xx/SBfw.usb" vendor "Trust" model "Compact Scan USB 19200" afe 0x20 0x02 0x22 0x03 0x1f 0x04 ``` -------------------------------- ### Set/Get Interface Options Source: http://sane-project.org/sanei/sanei__pa4s2_8h.html Allows setting or getting various operational options for the PA4S2 interface. The 'options' parameter is a bitmask, and 'set' indicates whether to set or get the options. ```c SANE_Status | sanei_pa4s2_options (u_int *options, int set) ``` -------------------------------- ### SANE Get Parameters Source: http://sane-project.org/sanei/sanei__backend_8h.html Retrieves the parameters for SANE. ```APIDOC ## get_parameters() ### Description Retrieves the parameters for SANE. ### Method N/A (Function Signature) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **SANE_Parameters*** (pointer) - Pointer to SANE parameters structure. #### Response Example N/A ``` -------------------------------- ### Get Backend Version and Scanner Hardware Info Source: http://sane-project.org/man/sane-mustek_pp.5.html Execute this command as root to retrieve the backend version and scanner hardware details. Ensure the 'mustek_pp' backend is listed in dll.conf and the correct port address is set in mustek_pp.conf if your scanner is not detected. ```bash SANE_DEBUG_MUSTEK_PP=128 scanimage -L ``` -------------------------------- ### sanei_thread_begin Source: http://sane-project.org/sanei/sanei__thread_8h_source.html Spawns a new task. ```APIDOC ## SANE_Pid sanei_thread_begin(int(*func)(void *args), void *args) ### Description Spawn a new task. ``` -------------------------------- ### GET /options/color-led Source: http://sane-project.org/man/sane-hp5590.5.html Retrieves the current state of the color LED indicators. ```APIDOC ## GET /options/color-led ### Description Returns the state of the color LED indicators. ### Method GET ### Response #### Success Response (200) - **state** (string) - The LED state, either "color" or "black_white". ``` -------------------------------- ### GET /sanei_usb_get_descriptor Source: http://sane-project.org/sanei/sanei__usb_8h.html Retrieves information from the USB device descriptor for a specified device. ```APIDOC ## GET /sanei_usb_get_descriptor ### Description Retrieves information from the USB device descriptor. This is useful for obtaining device revisions and other data reported by the USB system. ### Method GET ### Parameters #### Path Parameters - **dn** (SANE_Int) - Required - The device number. - **desc** (struct sanei_usb_dev_descriptor *) - Required - Pointer to the structure where the information will be stored. ### Response #### Success Response (SANE_STATUS_GOOD) - **SANE_STATUS_GOOD** - Operation successful. - **SANE_STATUS_UNSUPPORTED** - Feature not supported by the OS or SANE. - **SANE_STATUS_INVAL** - An error occurred. ``` -------------------------------- ### GET /options/doc-in-adf Source: http://sane-project.org/man/sane-hp5590.5.html Checks if a document is available in the automatic document feeder (ADF). ```APIDOC ## GET /options/doc-in-adf ### Description Returns the state of the document-available indicator of the ADF. ### Method GET ### Response #### Success Response (200) - **state** (string) - The state, either "yes" or "no". ``` -------------------------------- ### sanei_usb_testing_enable_replay Source: http://sane-project.org/sanei/sanei__usb_8h.html Initializes the sanei_usb subsystem for replay testing by mocking the USB stack. Must be called before sanei_usb_init(). ```APIDOC ## sanei_usb_testing_enable_replay ### Description Initializes sanei_usb for testing by mocking the whole USB stack. This function must be called before sanei_usb_init(). ### Parameters #### Path Parameters - **path** (SANE_String_Const) - Required - Path to the XML data file. - **development_mode** (int) - Required - Enables development mode. ``` -------------------------------- ### GET /options/counter-value Source: http://sane-project.org/man/sane-hp5590.5.html Retrieves the current counter value displayed on the scanner LCD. ```APIDOC ## GET /options/counter-value ### Description Returns the counter value as shown on the LCD. ### Method GET ### Response #### Success Response (200) - **value** (integer) - The counter value in the range of 1 to 99. ``` -------------------------------- ### Determine SANE version Source: http://sane-project.org/man/sane-p5.5.html Command to identify the currently installed version of SANE. ```bash scanimage -V ``` -------------------------------- ### Configure and Attach Devices Source: http://sane-project.org/sanei/sanei__config_8h_source.html Parses a configuration file, reads options, and attempts to attach devices found within it. Uses a provided callback for device attachment. ```c extern SANE_Status sanei_configure_attach ( const char *config_file, SANEI_Config *config, SANE_Status (*config_attach)(SANEI_Config *config, const char *devname, void *data), void *data ); ``` -------------------------------- ### void sanei_config_attach_matching_devices() Source: http://sane-project.org/sanei/sanei__config_8h.html Expands device name patterns into a list of devices, supporting standard names and SCSI specifications. ```APIDOC ## void sanei_config_attach_matching_devices(const char *name, SANE_Status(*attach)(const char *dev)) ### Description Expands device name patterns into a list of devices. Supports standard device names and SCSI specifications (VENDOR, MODEL, TYPE, BUS, CHANNEL, ID, LUN). ### Parameters #### Path Parameters - **name** (const char *) - Required - Device name pattern - **attach** (SANE_Status(*)(const char *dev)) - Required - Attach function callback ``` -------------------------------- ### SANE Entry Points Source: http://sane-project.org/sanei/sanei__wire_8h_source.html Documentation for SANE entry points, including read and start operations. ```APIDOC ## SANE_Status ENTRY() read (SANE_Handle, SANE_Byte *, SANE_Int, SANE_Int *) ### Description Reads data from a SANE device. Internationalization for SANE backends. ### Method ENTRY ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (SANE_Status) - **SANE_Status** (SANE_Status) - Status code indicating success or failure. ``` ```APIDOC ## SANE_Status ENTRY() start (SANE_Handle) ### Description Starts a SANE operation. Internationalization for SANE backends. ### Method ENTRY ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (SANE_Status) - **SANE_Status** (SANE_Status) - Status code indicating success or failure. ```