Logo Search packages:      
Sourcecode: hamlib version File versions  Download package

int HAMLIB_API par_read_status ( hamlib_port_t port,
unsigned char *  status 
)

Get parallel port status.

Parameters:
port 
status 
Returns:
RIG_OK or < 0 for error

Definition at line 302 of file parallel.c.

References hamlib_port_t::fd, rig_debug(), RIG_DEBUG_ERR, RIG_EIO, RIG_ENIMPL, and RIG_OK.

{
#ifdef HAVE_LINUX_PPDEV_H
      int ret;
      unsigned char sta;
      ret = ioctl(port->fd, PPRSTATUS, &sta);
      *status = sta ^ SP_ACTIVE_LOW_BITS;
      return ret == 0 ? RIG_OK : -RIG_EIO;
#elif defined(HAVE_DEV_PPBUS_PPI_H)
      int ret;
      unsigned char sta;
      ret = ioctl(port->fd, PPIGSTATUS, &sta);
      *status = sta ^ SP_ACTIVE_LOW_BITS;
      return ret == 0 ? RIG_OK : -RIG_EIO;
#elif defined(WIN32)
      unsigned char ret;
      unsigned int dummy;

      if (!(DeviceIoControl((HANDLE)(port->fd), NT_IOCTL_STATUS, NULL, 0, &ret, 
                  sizeof(ret), (LPDWORD)&dummy, NULL))) {
            rig_debug(RIG_DEBUG_ERR, "%s: DeviceIoControl failed!\n", __FUNCTION__);
      }

      *status = ret ^ S1284_INVERTED;
#endif
      return -RIG_ENIMPL;
}


Generated by  Doxygen 1.6.0   Back to index