Blame doc/ieee1284_get_deviceid.3

Packit d36e9b
.\"     Title: ieee1284_get_deviceid
Packit d36e9b
.\"    Author: Tim Waugh <twaugh@redhat.com>
Packit d36e9b
.\" Generator: DocBook XSL Stylesheets v1.72.0 <http://docbook.sf.net/>
Packit d36e9b
.\"      Date: 09/18/2007
Packit d36e9b
.\"    Manual: Functions
Packit d36e9b
.\"    Source: 
Packit d36e9b
.\"
Packit d36e9b
.TH "IEEE1284_GET_DEVICEI" "3" "09/18/2007" "" "Functions"
Packit d36e9b
.\" disable hyphenation
Packit d36e9b
.nh
Packit d36e9b
.\" disable justification (adjust text to left margin only)
Packit d36e9b
.ad l
Packit d36e9b
.SH "NAME"
Packit d36e9b
ieee1284_get_deviceid \- retrieve an IEEE 1284 Device ID
Packit d36e9b
.SH "SYNOPSIS"
Packit d36e9b
.sp
Packit d36e9b
.ft B
Packit d36e9b
.nf
Packit d36e9b
#include <ieee1284.h>
Packit d36e9b
.fi
Packit d36e9b
.ft
Packit d36e9b
.HP 30
Packit d36e9b
.BI "ssize_t ieee1284_get_deviceid(struct\ parport\ *" "port" ", int\ " "daisy" ", int\ " "flags" ", char\ *" "buffer" ", size_t\ " "len" ");"
Packit d36e9b
.SH "DESCRIPTION"
Packit d36e9b
.PP
Packit d36e9b
This function is for retrieving the IEEE 1284 Device ID of the specified device. The device is specified by the
Packit d36e9b
\fIport\fR
Packit d36e9b
to which it is attached, and optionally an address (\fIdaisy\fR) on the daisy chain of devices on that port.
Packit d36e9b
.PP
Packit d36e9b
\fIdaisy\fR
Packit d36e9b
should be −1 to indicate that the device is not participating in a IEEE 1284.3 daisy chain, meaning it is the last (or only) device on the port, or should be a number from 0 to 3 inclusive to indicate that it has the specified daisy chain address (0 is next to the port).
Packit d36e9b
.PP
Packit d36e9b
The
Packit d36e9b
\fIflags\fR
Packit d36e9b
parameter should be a bitwise union of any flags that the program wants to use. Available flags are:
Packit d36e9b
.PP
Packit d36e9b
\fBF1284_FRESH\fR
Packit d36e9b
.RS 4
Packit d36e9b
Guarantee a fresh Device ID. A cached or OS\-provided ID will not be used.
Packit d36e9b
.RE
Packit d36e9b
.PP
Packit d36e9b
The provided
Packit d36e9b
\fIbuffer\fR
Packit d36e9b
must be at least
Packit d36e9b
\fIlen\fR
Packit d36e9b
bytes long, and will contain the Device ID including the initial two\-byte length field and a terminating zero byte on successful return, or as much of the above as will fit into the buffer.
Packit d36e9b
.SH "RETURN VALUE"
Packit d36e9b
.PP
Packit d36e9b
A return value less than zero indicates an error as below. Otherwise, the return value is the number of bytes of
Packit d36e9b
\fIbuffer\fR
Packit d36e9b
that have been filled. A return value equal to the length of the buffer indicates that the Device ID may be longer than the buffer will allow.
Packit d36e9b
.PP
Packit d36e9b
\fBE1284_NOID\fR
Packit d36e9b
.RS 4
Packit d36e9b
The device did not provide an IEEE 1284 Device ID when interrogated (perhaps by the operating system if
Packit d36e9b
\fBF1284_FRESH\fR
Packit d36e9b
was not specified).
Packit d36e9b
.RE
Packit d36e9b
.PP
Packit d36e9b
\fBE1284_NOTIMPL\fR
Packit d36e9b
.RS 4
Packit d36e9b
One or more of the supplied flags is not supported in this implementation, or if no flags were supplied then this function is not implemented for this type of port or this type of system. This can also be returned if a daisy chain address is specified but daisy chain Device IDs are not yet supported.
Packit d36e9b
.RE
Packit d36e9b
.PP
Packit d36e9b
\fBE1284_NOTAVAIL\fR
Packit d36e9b
.RS 4
Packit d36e9b
\fBF1284_FRESH\fR
Packit d36e9b
was specified and the library is unable to access the port to interrogate the device.
Packit d36e9b
.RE
Packit d36e9b
.PP
Packit d36e9b
\fBE1284_NOMEM\fR
Packit d36e9b
.RS 4
Packit d36e9b
There is not enough memory.
Packit d36e9b
.RE
Packit d36e9b
.PP
Packit d36e9b
\fBE1284_INIT\fR
Packit d36e9b
.RS 4
Packit d36e9b
There was a problem initializing the port.
Packit d36e9b
.RE
Packit d36e9b
.PP
Packit d36e9b
\fBE1284_INVALIDPORT\fR
Packit d36e9b
.RS 4
Packit d36e9b
The
Packit d36e9b
\fIport\fR
Packit d36e9b
parameter is invalid.
Packit d36e9b
.RE
Packit d36e9b
.SH "NOTES"
Packit d36e9b
.PP
Packit d36e9b
Unless the
Packit d36e9b
\fBF1284_FRESH\fR
Packit d36e9b
flag is given, the library will try to find the device's ID as unobtrusively as possible. First it will ask the operating system if it knows it, and then it will try actually asking the device for it. Because of this, the Device ID may be partially computed (the length field, for example) or even partially missing if the operating system has only remembered some parts of the ID. To guarantee that you are getting the bytes that the device sent, use
Packit d36e9b
\fBF1284_FRESH\fR. Be aware that the operating system may allow any user to inspect the Device IDs that it provides, whereas device access is normally more restricted.
Packit d36e9b
.PP
Packit d36e9b
The initial two\-byte length field is a big\-endian 16 bit unsigned integer provided by the device and may not be accurate. In particular, it is meant to indicate the length of the entire string including the length field itself; however, some manufacturers exclude the length field or just set the length field to some arbitrary number greater than the ID length.
Packit d36e9b
.SH "AUTHOR"
Packit d36e9b
.PP
Packit d36e9b
\fBTim Waugh\fR <\&twaugh@redhat.com\&>
Packit d36e9b
.sp -1n
Packit d36e9b
.IP "" 4
Packit d36e9b
Author.
Packit d36e9b
.SH "COPYRIGHT"
Packit d36e9b
Copyright \(co 2001\-2003 Tim Waugh
Packit d36e9b
.br
Packit d36e9b