IEEE1284_GET_DEVICEI(3)
π ieee1284_get_deviceid β that's IEEE1284_GET_DEVICEI(3), from the Functions girlies β¨
okay so bestie. you wanna know what a printer is. like, its whole identity. its government name. that's this function, and honestly? it ate. π
πΈ SYNOPSIS πΈ
#include <ieee1284.h>
ssize_t ieee1284_get_deviceid(struct parport *port, int daisy,
int flags, char *buffer, size_t len);
π¦ DESCRIPTION π¦
so this function? it's the one that goes and fetches the IEEE 1284 Device ID of whatever device you point at. and how do you point at it? two ways, bestie:
- by the port it's plugged into
- optionally by an address (
daisy) on the daisy chain of devices hanging off that port
now daisy is giving very specific instructions and you need to respect them:
-1means "this device is NOT in an IEEE 1284.3 daisy chain, it's the last (or only) one on the port" π0through3inclusive means "yep, it's on the chain, and this is its address" β and btw0is the one next to the port, just so you know the order π
then there's flags, and she's a bitwise union of whatever flags your program wants to use. here's the menu:
F1284_FRESHβ no cap, guaranteed fresh Device ID. a cached one or an OS-provided one will not be used. it's giving farm-to-table. π
and your buffer? it has to be at least len bytes long, okay? on a successful return it'll hold the Device ID β including the initial two-byte length field and a terminating zero byte β or like, as much of all that as will actually fit in the buffer. so maybe make it big. just saying. π
π RETURN VALUE π
if the return value is less than zero, that's an error (see the list below, bestie). otherwise, the return value is the number of bytes of buffer that got filled.
and if the return value equals the length of the buffer? that's the function gently telling you the Device ID might be longer than your buffer can hold. it's not mad, it's just disappointed. π
the errors, one by one:
E1284_NOIDβ the device did not provide an IEEE 1284 Device ID when interrogated (maybe the OS was asked instead, ifF1284_FRESHwasn't specified). she simply had nothing to say. πE1284_NOTIMPLβ one or more of the flags you passed isn't supported in this implementation, OR if you passed no flags at all, then this function just isn't implemented for this type of port or this type of system. also can come back at you if you specified a daisy chain address but daisy chain Device IDs are not yet supported. π«E1284_NOTAVAILβ you saidF1284_FRESHand the library can't even get at the port to interrogate the device. rude.E1284_NOMEMβ there is not enough memory. tragic.E1284_INITβ there was a problem initializing the port. π΅E1284_INVALIDPORTβ theportparameter is invalid. check her again. π
π NOTES π
okay this is the part where you actually listen, because it's important.
unless you give the F1284_FRESH flag, the library is gonna try to find the device's ID as unobtrusively as possible. the order of operations is:
- first it asks the operating system if it already knows it
- then it'll try actually asking the device for it
and because of that whole vibe, the Device ID you get back may be partially computed (the length field, for example) or even partially missing if the OS only remembered some parts of the ID. to guarantee you're getting the actual bytes the device sent, use F1284_FRESH. periodt.
β οΈ also be aware: the operating system may allow any user to inspect the Device IDs it provides, whereas actual device access is normally way more restricted. so like, yikes, know that before you go F1284_FRESH-ing everywhere.
and about that initial two-byte length field β she's a big-endian 16 bit unsigned integer provided by the device, and she may not be accurate. in particular, it's 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. manufacturers stay unserious. π
π AUTHOR π
- Tim Waugh
<twaugh@redhat.com>β Author.
π COPYRIGHT π
Copyright Β© 2001-2003 Tim Waugh
and that's the whole page bestie, you're so welcome π this was IEEE1284_GET_DEVICEI(3), from the Functions section, dated 09/18/2007 β go forth and interrogate some devices, mwah π«Άβ¨
π¦ where this page comes from
- alpine 3.24: libieee1284-doc 0.2.11-r4 Β· GPL-2.0-or-later
- debian bookworm: libieee1284-3-dev 0.2.11-14
- debian trixie: libieee1284-3-dev 0.2.11-14.1+b1
- opensuse-leap 16.0: libieee1284-devel 0.2.11-bp160.1.13 Β· GPL-2.0-or-later AND MIT
- opensuse-leap 16.0: libieee1284-devel 0.2.11-bp160.1.13 Β· GPL-2.0-or-later AND MIT
- opensuse-leap 16.0: libieee1284-devel 0.2.11-bp160.1.13 Β· GPL-2.0-or-later AND MIT
- opensuse-leap 16.0: libieee1284-devel 0.2.11-bp160.1.13 Β· GPL-2.0-or-later AND MIT
- ubuntu jammy: libieee1284-3-dev 0.2.11-14build2
- ubuntu noble: libieee1284-3-dev 0.2.11-14.1build1
- ubuntu questing: libieee1284-3-dev 0.2.11-14.1build1
- ubuntu resolute: libieee1284-3-dev 0.2.11-14.1build2
- ubuntu stonking: libieee1284-3-dev 0.2.11-15 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms