IEEE1284_STATUS(3)

πŸ“¦
version 0.2.11 Β· 7 versions
, in alpine 3.24, debian bookworm, debian trixie, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ IEEE1284_STATUS(3) ✨ β€” the Functions girlies' page πŸ’…

okay so bestie, we're doing ieee1284_read_status and ieee1284_wait_status today, and I promise it's not scary. they analyse status lines. that's the whole vibe. let's go πŸ¦‹


🌸 NAME 🌸

ieee1284_read_status, ieee1284_wait_status β€” analyse status lines πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

#include <ieee1284.h>

int ieee1284_read_status(struct parport *port);

int ieee1284_wait_status(struct parport *port, unsigned char mask,
                         unsigned char val, struct timeval *timeout);

πŸ’– DESCRIPTION πŸ’–

so. there are five status lines, and one of them is usually inverted on PC-style ports 😭 like why. anyway. where they differ, libieee1284 operates on the IEEE 1284 values, not the PC-style inverted values. no cap. so don't come at me with the PC numbers.

the status lines are represented by this enumeration, and yes you should literally just read it, it's giving ✨

enum ieee1284_status_bits
{
  S1284_NFAULT = 0x08,
  S1284_SELECT = 0x10,
  S1284_PERROR = 0x20,
  S1284_NACK   = 0x40,
  S1284_BUSY   = 0x80,
  /* To convert those values into PC-style register values, use this: */
  S1284_INVERTED = S1284_BUSY,
};

these functions all act on the parallel port associated with port, which must be claimed. like, claimed claimed. don't skip that step bestie 🫢

the purpose of ieee1284_wait_status is to wait until particular status lines have specified values. its timeout parameter may be modified on return πŸ‘€ (yes, it edits your stuff. iconic behaviour honestly.)


πŸ”₯ RETURN VALUE πŸ”₯

for ieee1284_read_status, the return value is a non-negative integer with bits set as appropriate representing the status lines. a negative result indicates an error πŸ’€

for ieee1284_wait_status, the return value is E1284_OK if the status lines now reflect the desired values (i.e. status & mask is val), or a negative result indicating an error.

possible error codes, let's get into it:

  • E1284_NOTIMPL β€” the port lacks the required capability. this could be due to a limitation of this version of libieee1284, or a hardware limitation. hardware said no πŸ™ˆ
  • E1284_NOTAVAIL β€” access to the status lines is not available on this port type. not available, not the moment, not the vibe.
  • E1284_TIMEDOUT β€” the timeout has elapsed. clock ran out, girlie ⏰
  • E1284_INVALIDPORT β€” the port parameter is invalid (for instance, perhaps the port is not claimed). you forgot to claim it, didn't you. I KNEW it 😭

🧚 NOTES 🧚

the nAck pin is often able to trigger interrupts on the host machine. with operating system help these interrupts may be visible to the application via the file descriptor returned by ieee1284_get_irq_fd. cute, right? πŸ’œ

under Linux, the conditions are that the parallel port driver knows which interrupt line to use and is using it, and that the relevant /dev/parport device node is accessible and backed by a device driver. all three. no shortcuts. that's the whole checklist βœ…


πŸ‘‘ AUTHOR πŸ‘‘

Tim Waugh <twaugh@redhat.com> Author. (yes, THE author. main character energy fr fr 🌟)


Copyright Β© 2001-2003 Tim Waugh


and that's the page bestie!! this one's from the Functions manual, dated 09/18/2007, and it goes by IEEE1284_STATUS(3) β€” go forth and read those status lines, you absolute legend πŸŽ€πŸ’…βœ¨