parallel.c revision 4b9d6701570cb98fd36e209314239d104ec584d3
/* -*- c-basic-offset: 8 -*-
rdesktop: A Remote Desktop Protocol client.
Copyright (C) Matthew Chapman 1999-2007
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Oracle elects to use only
* the General Public License version 2 (GPLv2) at this time for any software where
* a choice of GPL license versions is made available with the language indicating
* that GPLv2 or any later version may be used, or where a choice of which version
* of the GPL is applied is otherwise unspecified.
*/
#define MAX_PARALLEL_DEVICES 1
#define FILE_DEVICE_PARALLEL 0x22
#define IOCTL_PAR_QUERY_RAW_DEVICE_ID 0x0c
#include "rdesktop.h"
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#if defined(__linux__)
#endif
extern RDPDR_DEVICE g_rdpdr_device[];
/* Enumeration of devices from rdesktop.c */
/* returns numer of units found and initialized. */
/* when it arrives to this function. */
int
{
char *pos2;
int count = 0;
/* skip the first colon */
optarg++;
{
/* set device type */
count++;
(*id)++;
}
return count;
}
static RD_NTSTATUS
{
int parallel_fd;
if (parallel_fd == -1)
{
perror("open");
return RD_STATUS_ACCESS_DENIED;
}
/* all read and writes should be non blocking */
perror("fcntl");
#if defined(LPABORT)
/* Retry on errors */
#endif
*handle = parallel_fd;
return RD_STATUS_SUCCESS;
}
static RD_NTSTATUS
{
int i = get_device_index(handle);
if (i >= 0)
g_rdpdr_device[i].handle = 0;
return RD_STATUS_SUCCESS;
}
static RD_NTSTATUS
{
return RD_STATUS_SUCCESS;
}
static RD_NTSTATUS
{
int rc = RD_STATUS_SUCCESS;
if (n < 0)
{
#if defined(LPGETSTATUS)
int status;
#endif
*result = 0;
switch (errno)
{
case EAGAIN:
case ENOSPC:
case EIO:
default:
}
#if defined(LPGETSTATUS)
{
/* coming soon: take care for the printer status */
}
#endif
}
*result = n;
return rc;
}
static RD_NTSTATUS
{
return RD_STATUS_INVALID_PARAMETER;
/* extract operation */
request >>= 2;
request &= 0xfff;
switch (request)
{
default:
printf("\n");
}
return RD_STATUS_SUCCESS;
}
};