1IEEE1284_GET_DEVICEI(3) Functions IEEE1284_GET_DEVICEI(3)
2
3
4
6 ieee1284_get_deviceid - retrieve an IEEE 1284 Device ID
7
9 #include <ieee1284.h>
10
11 ssize_t ieee1284_get_deviceid(struct parport *port, int daisy,
12 int flags, char *buffer, size_t len);
13
15 This function is for retrieving the IEEE 1284 Device ID of the
16 specified device. The device is specified by the port to which it is
17 attached, and optionally an address (daisy) on the daisy chain of
18 devices on that port.
19
20 daisy should be -1 to indicate that the device is not participating in
21 a IEEE 1284.3 daisy chain, meaning it is the last (or only) device on
22 the port, or should be a number from 0 to 3 inclusive to indicate that
23 it has the specified daisy chain address (0 is next to the port).
24
25 The flags parameter should be a bitwise union of any flags that the
26 program wants to use. Available flags are:
27
28 F1284_FRESH
29 Guarantee a fresh Device ID. A cached or OS-provided ID will not be
30 used.
31
32 The provided buffer must be at least len bytes long, and will contain
33 the Device ID including the initial two-byte length field and a
34 terminating zero byte on successful return, or as much of the above as
35 will fit into the buffer.
36
38 A return value less than zero indicates an error as below. Otherwise,
39 the return value is the number of bytes of buffer that have been
40 filled. A return value equal to the length of the buffer indicates that
41 the Device ID may be longer than the buffer will allow.
42
43 E1284_NOID
44 The device did not provide an IEEE 1284 Device ID when interrogated
45 (perhaps by the operating system if F1284_FRESH was not specified).
46
47 E1284_NOTIMPL
48 One or more of the supplied flags is not supported in this
49 implementation, or if no flags were supplied then this function is
50 not implemented for this type of port or this type of system. This
51 can also be returned if a daisy chain address is specified but
52 daisy chain Device IDs are not yet supported.
53
54 E1284_NOTAVAIL
55 F1284_FRESH was specified and the library is unable to access the
56 port to interrogate the device.
57
58 E1284_NOMEM
59 There is not enough memory.
60
61 E1284_INIT
62 There was a problem initializing the port.
63
64 E1284_INVALIDPORT
65 The port parameter is invalid.
66
68 Unless the F1284_FRESH flag is given, the library will try to find the
69 device's ID as unobtrusively as possible. First it will ask the
70 operating system if it knows it, and then it will try actually asking
71 the device for it. Because of this, the Device ID may be partially
72 computed (the length field, for example) or even partially missing if
73 the operating system has only remembered some parts of the ID. To
74 guarantee that you are getting the bytes that the device sent, use
75 F1284_FRESH. Be aware that the operating system may allow any user to
76 inspect the Device IDs that it provides, whereas device access is
77 normally more restricted.
78
79 The initial two-byte length field is a big-endian 16 bit unsigned
80 integer provided by the device and may not be accurate. In particular,
81 it is meant to indicate the length of the entire string including the
82 length field itself; however, some manufacturers exclude the length
83 field or just set the length field to some arbitrary number greater
84 than the ID length.
85
87 Tim Waugh <twaugh@redhat.com>
88 Author.
89
91 Copyright © 2001-2003 Tim Waugh
92
93
94
95[FIXME: source] 07/28/2020 IEEE1284_GET_DEVICEI(3)