IEEE1284_TRANSFER(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_TRANSFER πŸ’–

okay bestie, welcome to IEEE1284_TRANSFER(3) β€” that's section 3 of the manual, aka the functions zone. this is the one about actually moving bytes around on your parallel port. sit down, grab a strawberry πŸ“, we're doing this.


✨ NAME ✨

ieee1284_nibble_read, ieee1284_compat_write, ieee1284_byte_read, ieee1284_epp_read_data, ieee1284_epp_write_data, ieee1284_epp_read_addr, ieee1284_epp_write_addr, ieee1284_ecp_read_data, ieee1284_ecp_write_data, ieee1284_ecp_read_addr, ieee1284_ecp_write_addr β€” the data transfer functions πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

first things first, you gotta include the header, no cap:

#include <ieee1284.h>

and here's the whole girl squad of signatures, all of them, every single one:

ssize_t ieee1284_nibble_read(struct parport *port, int flags,
                             char *buffer, size_t len);

ssize_t ieee1284_compat_write(struct parport *port, int flags,
                              const char *buffer, size_t len);

ssize_t ieee1284_byte_read(struct parport *port, int flags,
                           char *buffer, size_t len);

ssize_t ieee1284_epp_read_data(struct parport *port, int flags,
                               char *buffer, size_t len);

ssize_t ieee1284_epp_write_data(struct parport *port, int flags,
                                const char *buffer, size_t len);

ssize_t ieee1284_epp_read_addr(struct parport *port, int flags,
                               char *buffer, size_t len);

ssize_t ieee1284_epp_write_addr(struct parport *port, int flags,
                                char *buffer, size_t len);

ssize_t ieee1284_ecp_read_data(struct parport *port, int flags,
                               char *buffer, size_t len);

ssize_t ieee1284_ecp_write_data(struct parport *port, int flags,
                                const char *buffer, size_t len);

ssize_t ieee1284_ecp_read_addr(struct parport *port, int flags,
                               char *buffer, size_t len);

ssize_t ieee1284_ecp_write_addr(struct parport *port, int flags,
                                char *buffer, size_t len);

look at them. so organized. so iconic. πŸ‘‘


🌸 DESCRIPTION 🌸

okay so this whole set of functions is for transferring bytes in whatever transfer mode is relevant at the time. for ECP and EPP modes you've got two flavors of transfer available: data and address β€” and in ECP, address is usually called channel, iykyk.

the port you pass in must be a claimed port. not a random port you found on the street. a claimed one. βœ‹

the buffer you supply has to be at least len bytes long. when you're reading, the transferred data gets stored into the buffer. when you're writing, the data to be transferred gets taken from the buffer. simple as that πŸ’…

now the timeout tea β˜•:

  • for reads (peripheral β†’ host): if there's no data available and F1284_NONBLOCK is not in effect, the inactivity timer starts. if data shows up before the inactivity time-out runs out, it gets read. otherwise the return value will be E1284_TIMEDOUT. 😭
  • for writes (host β†’ peripheral): if the peripheral is not willing to accept data and F1284_NONBLOCK is not in effect, the inactivity timer starts. if the peripheral says "yeah I'll take it" before the inactivity time-out elapses, it gets sent. otherwise the return value will be E1284_TIMEDOUT.

and the flags can change the vibe slightly, so let's go through them one by one:

  • F1284_NONBLOCK β€” for reads (peripheral β†’ host): if no data is available, return immediately (with E1284_TIMEDOUT). for writes (host β†’ peripheral): if the peripheral is not willing to accept data, return immediately (with E1284_TIMEDOUT). basically "don't wait around bestie, I have places to be." πŸ’…
  • F1284_SWE β€” don't use hardware assistance for the transfer. instead, set the parallel port pins according to the wire protocol. doing it by hand, the old-fashioned way. πŸŽ€
  • F1284_RLE (for ECP only) β€” use run length encoding. if the peripheral is in ECP mode with RLE, calls to ieee1284_ecp_read_data must set this flag so the RLE coming from the peripheral gets interpreted correctly, and calls to ieee1284_ecp_write_data may set this flag in order to take advantage of RLE. so: reads = mandatory, writes = optional flex. ✨
  • F1284_FASTEPP (for EPP only) β€” use multi-byte transfers. several bytes at a time get transferred using hardware assistance, if supporting hardware is present. the price of this increased speed is that the return value will be less reliable when this flag is used. fast and sloppy, we love a risky queen but read that again: less reliable. πŸ”₯
for ECP mode, a given direction is in force at any particular time, and it's up to the application to make sure it's only writing when in forward mode, and reading when in reverse mode. do NOT mix them up. the mode will not forgive you.

πŸ’€ RETURN VALUE πŸ’€

the return value is the number of bytes successfully transferred or, if it's negative, one of these lil guys:

  • E1284_NOTIMPL β€” this transfer mode and flags combination is not yet implemented in libieee1284. sorry, not built yet. πŸ™ˆ
  • E1284_TIMEDOUT β€” timed out waiting for peripheral to handshake. the peripheral ghosted you. πŸ’€
  • E1284_NOMEM β€” not enough memory is available. 😭
  • E1284_SYS β€” there was a problem at the operating system level. the global variable errno has been set appropriately.
  • E1284_INVALIDPORT β€” the port parameter is invalid (for instance, perhaps the port is not claimed). wrong port, bestie.

if any bytes are successfully transferred, that number is returned. an error is only returned if no bytes are transferred. periodt.

also, for host-to-peripheral transfers, all data is at the peripheral by the time the call returns. all of it. delivered. 🫢


🌈 SEE ALSO 🌈

ieee1284_ecp_fwd_to_rev(3)


πŸ’œ AUTHOR πŸ’œ

Tim Waugh <twaugh@redhat.com> β€” Author. πŸ’…


Copyright Β© 2001-2003 Tim Waugh


and that's the whole page, bestie! 🌟 this was IEEE1284_TRANSFER(3), dated 09/18/2007, and it lives right there in the same manual as its friends. go forth and transfer those bytes responsibly β€” and remember, only write in forward mode. mwah πŸ’–βœ¨πŸŽ€