IEEE1284_GET_IRQ_FD(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

okay bestie, pull up a chair 🫢 you just landed on ieee1284_get_irq_fd(3) β€” that's the one from the Functions section of the manual, and it's all about interrupt notification. Let's get into it. πŸ’–


🌸 NAME 🌸

ieee1284_get_irq_fd, ieee1284_clear_irq β€” interrupt notification, aka "hey bestie, tell me when the port pokes me" πŸ’…


✨ SYNOPSIS ✨

#include <ieee1284.h>

int ieee1284_get_irq_fd(struct parport *port);

int ieee1284_clear_irq(struct parport *port, unsigned int *count);

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe. If the port has a configured interrupt line and the port type supports interrupt notification, then you can literally get yourself a file descriptor that works with select(2) or poll(2). 😌

Any event β€” readable, writable, or exception β€” means an interrupt has been triggered. That's it, that's the signal. πŸ””

⚠️ No operations other than select or poll may be performed on the file descriptor. Not even a lil peek. Do NOT.

The port must be open in order to call ieee1284_get_irq_fd, and it must be claimed when you're using select or poll. Two separate conditions, both required, no skipping. βœ‹

Also, and this is important:

  • The caller must not close the file descriptor πŸ™…β€β™€οΈ
  • The caller may not use it at all when the port is not claimed

Then, once an interrupt has been detected, the caller must call ieee1284_clear_irq to clear the interrupt condition. 🧹 And here's the cute part: at that moment you can grab the number of interrupts raised by supplying a non-NULL count. 🌟


πŸ’… RETURN VALUE πŸ’…

For ieee1284_get_irq_fd 🌈

If the return value is negative then it's an error code (listed below). Otherwise? It's a valid file descriptor, and you're so back. πŸ‘‘

  • E1284_NOTAVAIL β€” No such file descriptor is available. 😭
  • E1284_INVALIDPORT β€” The port parameter is invalid (for instance, perhaps the port is not open). πŸ™ˆ

For ieee1284_clear_irq πŸŽ€

  • E1284_OK β€” The interrupt has been cleared. And if count was not NULL, the count of interrupts has been atomically stored to count and reset. Slay. ✨
  • E1284_NOTAVAIL β€” The count parameter was not NULL but interrupt counting is not supported on this type of port. The interrupt has been cleared, though, so don't cry. 🫢
  • E1284_SYS β€” There was a problem clearing the interrupt. πŸ’€
  • E1284_INVALIDPORT β€” The port parameter is invalid (for instance, perhaps the port is not claimed). πŸ™ˆ

πŸ‘‘ AUTHOR πŸ‘‘

Tim Waugh <twaugh@redhat.com>

  • Author. πŸ’œ

Copyright Β© 2001-2003 Tim Waugh


and that's the whole page, bestie, no notes. this one shipped as part of the 09/18/2007 release of the IEEE1284_GET_IRQ_FD(3) page β€” iconic date, iconic energy, go clear some interrupts responsibly πŸ’–βœ¨πŸ¦‹