Prototypes for all source files.
More...
Go to the source code of this file.
|
int | caps_prn_usb_printer_identify (const struct usb_printer *pr, const struct caps_inif_table *db, const char **descr_ini, const char **param_dir) |
|
int | caps_prn_usb_printer_driver_get (const struct usb_printer *pr, const struct caps_inif_table *db, char **descr_ini) |
|
int | caps_prn_usb_printer_get_info (struct usb_printer *printer, const char *dnode) |
|
int | caps_prn_get_printer_driver_database (struct caps_inif_table *db) |
|
int | caps_prn_get_printing_providers_description (struct caps_inif_table *db, const char *filename) |
|
struct caps_inif_lock * | caps_prn_get_printer_device_database_locked (struct caps_inif_table *db) |
|
int | caps_prn_check_printer_entry (const struct caps_inif_table *db, const char *drv, const struct usb_printer *pr) |
|
int | caps_prn_set_printer_description (struct caps_inif_table *db, const char *section, struct caps_prn_printer_description *desc) |
|
int | caps_prn_get_printer_device_database (struct caps_inif_table *db) |
|
int | caps_prn_get_printer_device_description (const struct caps_inif_table *db, const char *section, struct caps_prn_printer_description *desc) |
|
int | caps_prn_launch_printer_provider (const char *descr_ini, const char *param_dir) |
|
- Copyright
- GNU Lesser General Public License 2.1
- Author
- Jürgen Borleis
- Warning
- Use as experimental
◆ caps_prn_printer_type
◆ caps_prn_usb_printer_identify()
int caps_prn_usb_printer_identify |
( |
const struct usb_printer * |
pr, |
|
|
const struct caps_inif_table * |
db, |
|
|
const char ** |
descr_ini, |
|
|
const char ** |
param_dir |
|
) |
| |
Identify a USB printer device if it is already known
- Parameters
-
[in] | pr | The USB printer description |
[in] | db | The run-time device database of currently known printer devices |
[out] | descr_ini | Name of the Printing Provider Description INI File |
[out] | param_dir | Name of the Printer Device Parameter Directory |
- Return values
-
0 | On success (descr_ini and param_dir are valid) |
-ENODEV | The requested printer isn't known, yet |
negative | Errno else |
On success this function provides valid descr_ini and param_dir pointers.
◆ caps_prn_usb_printer_driver_get()
Search for a printer driver for the given USB printer device
- Parameters
-
[in] | pr | The USB printer device to search for its driver |
[in] | db | Printer driver's database |
[out] | descr_ini | Where to store the pointer to the name of the driver's description INI file (must be freed after use) |
- Return values
-
0 | on success *descr_ini is valid |
-ENODEV | No printer driver for the requested printer device found |
negative | -errno else |
Walk trough the printer driver database entries and try to identify the corresponding driver for the given printer dervice.
The printer driver database is organized in levels. Each driver has a new level: It's filename (without the '.ini' extension).
- Note
- The pointer in descr_ini must be freed after use
◆ caps_prn_usb_printer_get_info()
int caps_prn_usb_printer_get_info |
( |
struct usb_printer * |
printer, |
|
|
const char * |
dnode |
|
) |
| |
Get the info about a printer, based on its device node
- Parameters
-
[out] | printer | Where to store the printer's information |
[in] | dnode | Device node in question |
- Return values
-
0 | On success |
-EINVAL | USB enumeration failed, USB detection failed |
-ENOENT | dnode seems invalid |
◆ caps_prn_get_printer_driver_database()
Read in the persistent printer driver database
- Parameters
-
[out] | db | Where to store the content (expected to be already initialised) |
- Return values
-
0 | on success |
-ENODEV | no drivers installed |
This reads in all existing INI files in the CAPS Printer Driver Database Directory
◆ caps_prn_get_printing_providers_description()
int caps_prn_get_printing_providers_description |
( |
struct caps_inif_table * |
db, |
|
|
const char * |
filename |
|
) |
| |
Read in one printing provider's description INI from the CAPS driver database directory
- Parameters
-
[out] | db | Where to store the content (expected to be already initialised) |
[in] | filename | Printing provider's description INI file name (name only, no path) |
- Returns
- 0 on success, negative errno else
This reads in an INI file with filename from the CAPS Printer Driver Database Directory
◆ caps_prn_get_printer_device_database_locked()
Read in the run-time printer device database and lock the corresponding INI file
- Parameters
-
[in,out] | db | Where to store the content (expected to be already initialised) |
- Returns
- Pointer to transparent info or NULL in case of a disaster
- Note
- The INI file is locked! Must be freed with caps_inif_locked_file_close()
-
Keep in mind, the file is locked and prevents other caps-printer instances doing their job.
- Precondition
- The CAPS Printer Device Database Directory must already exist
-
Needs root permissions
- Todo:
- Check if CAPS Printer Device Database Directory exists and output a useful error message if not
◆ caps_prn_check_printer_entry()
Check if one given driver from the printer driver database corresponds to the given USB printing device
- Parameters
-
[in] | db | The driver database |
[in] | drv | The 'level' where to search in the database |
[in] | pr | The USB printer device description/information |
- Return values
-
0 | The given driver corresponds to the USB printer device |
-ENODEV | The USB printer device doesn't match |
Compares USB specific information with a driver database entry.
◆ caps_prn_set_printer_description()
Add a new printer device to the list/database of known devices
- Parameters
-
[in,out] | db | The device database |
[in] | section | The specific printer section of this new data |
[in] | desc | The printer device description |
- Return values
-
0 | On success |
-EINVAL | You add a non-USB device (not yet supported) |
◆ caps_prn_get_printer_device_database()
Read in the run-time printer device database
- Parameters
-
[in,out] | db | Where to store the content |
- Return values
-
0 | On success |
-EINVAL | Error in INI file |
negative | Errno else (from open() for example) |
- Note
- The
db
doesn't include the content of the "Printer Device Parameter Directories" (CAPS Printer Device Parameter Directory)
- Precondition
db
must be already initialised and thus, empty
◆ caps_prn_get_printer_device_description()
Convert a device data base entry into our local description structure
- Parameters
-
[in] | db | The run-time device database of currently known printer devices |
[in] | section | The section to examine |
[in] | desc | |
- Returns
- 0 on success, negative errno else
- Todo:
This functionname should show we work with the persistent printer database -> run-time database
Error handling. Print correct missing entry if any!
- Todo:
- We do support nothing else than USB printers, yet
◆ caps_prn_launch_printer_provider()
int caps_prn_launch_printer_provider |
( |
const char * |
descr_ini, |
|
|
const char * |
param_dir |
|
) |
| |
Launch a printing provider
- Parameters
-
[in] | descr_ini | Printing provider's description INI file (file name only) |
[in] | param_dir | Parameter directory for this device (directory name only) |
- Return values
-
0 | On success |
negative | -errno else |
File descriptors:
- 0 stdin is closed
- 1 stdout
- 2 stderr
- 3 Line printer device node
Keep stdout and stderr open, the filedescriptor to the printer device node as well.
Calls the printer driver as:
</path/to/caps/exec/dir>/<drivername> --driver-ini=<driverdefault.ini> --parameter-dir=<parameterdir>
These specific options are expected when the printing provider uses libcapsprovider.