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

int HAMLIB_API par_read_control ( hamlib_port_t port,
unsigned char *  control 
)

Read control data for Parallel Port.

Parameters:
port 
control 

Definition at line 266 of file parallel.c.

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

Referenced by par_ptt_get(), and par_ptt_set().

{
#ifdef HAVE_LINUX_PPDEV_H
      int status;
      unsigned char ctrl;
      status = ioctl(port->fd, PPRCONTROL, &ctrl);
    if (status < 0)
        rig_debug(RIG_DEBUG_ERR,"ioctl(PPRCONTROL) failed: %s\n", strerror(errno));
      *control = ctrl ^ CP_ACTIVE_LOW_BITS;
      return status == 0 ? RIG_OK : -RIG_EIO;
#elif defined(HAVE_DEV_PPBUS_PPI_H)
      int status;
      unsigned char ctrl;
      status = ioctl(port->fd, PPIGCTRL, &ctrl);
      *control = ctrl ^ CP_ACTIVE_LOW_BITS;
      return status == 0 ? RIG_OK : -RIG_EIO;
#elif defined(WIN32)
      char ret;
      unsigned int dummy;

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

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


Generated by  Doxygen 1.6.0   Back to index