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

int HAMLIB_API par_read_data ( hamlib_port_t port,
unsigned char *  data 
)

Receive data on Parallel port.

Parameters:
port 
data 

Definition at line 191 of file parallel.c.

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

Referenced by par_dcd_get(), par_ptt_get(), and par_ptt_set().

{
#ifdef HAVE_LINUX_PPDEV_H
      int status;
      status = ioctl(port->fd, PPRDATA, data);
      return status == 0 ? RIG_OK : -RIG_EIO;
#elif defined(HAVE_DEV_PPBUS_PPI_H)
      int status;
      status = ioctl(port->fd, PPIGDATA, &data);
      return status == 0 ? RIG_OK : -RIG_EIO;
#elif defined(WIN32)
      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__);
      }

      return ret ^ S1284_INVERTED;
#endif
      return -RIG_ENIMPL;
}


Generated by  Doxygen 1.6.0   Back to index