A command line tool to retrieve some information about his printer device.
More...
- Copyright
- GNU Lesser General Public License 2.1
- Author
- Jürgen Borleis
- Warning
- Use as experimental
◆ IOCTL_IEEE1284_ID_GET
#define IOCTL_IEEE1284_ID_GET |
( |
|
cnt | ) |
_IOC(_IOC_READ, 'P', 1, cnt) |
◆ IOCTL_PRINTER_RESET
#define IOCTL_PRINTER_RESET _IOC(_IOC_NONE, 'P', 7, 0) |
◆ _prn_info_ieee_id_print()
static int _prn_info_ieee_id_print |
( |
int |
fd | ) |
|
|
static |
Retrieve printer's IEEE1284 ID and print it to stdout
- Parameters
-
[in] | fd | The printer's corresponding device node |
- Return values
-
0 | Successful |
Negative | errno else |
Don't know why the kernel does not export this IOCTL command. We need a '1' command to retrieve the IEEE1284 ID and a so called 'new' style IOCTL.
- Note
- In the returned IEEE1284 ID data set, a 16 bit count value in big endian notation leads the string and defines the whole size of the data including itself.
◆ _prn_info_status_print()
static int _prn_info_status_print |
( |
int |
fd | ) |
|
|
static |
Retrieve the printer's status and print a decoded list
- Parameters
-
[in] | fd | The printer's corresponding device node |
- Return values
-
0 | Successful |
Negative | errno else |
The kernel expands a signed char into an signed int. Thus, we recice a 0xffffffb0 if the printer is busy and out of paper.
◆ _prn_info_printer_reset()
static int _prn_info_printer_reset |
( |
int |
fd | ) |
|
|
static |
Reset the printer ('soft' style)
- Parameters
-
[in] | fd | The printer's corresponding device node |
- Return values
-
0 | Successful |
Negative | errno else |
Don't know why the kernel does not export this IOCTL command. We need a '7' (e.g. IOCNR_SOFT_RESET) command to trigger a soft reset and a so called 'new' style IOCTL.
◆ handle_nls()
static void handle_nls |
( |
void |
| ) |
|
|
static |
◆ print_help()
static void print_help |
( |
FILE * |
out | ) |
|
|
static |
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
◆ verbose
◆ long_options
const struct option long_options[] |
|
static |
Initial value:= {
{ .name = "verbose", .has_arg = no_argument, .val = 'v', },
{ .name = "help", .has_arg = no_argument, .val = 'h', },
{ .name = NULL, },
}