Don't claim the parport for exclusive access and release the port

after every access.
This commit is contained in:
Uwe Bonnes 2001-07-14 00:46:22 +00:00 committed by Alexandre Julliard
parent 187ed4106d
commit cf735f7a95
1 changed files with 22 additions and 21 deletions

View File

@ -93,13 +93,6 @@ char IO_pp_init(void)
WARN("Rejecting configuration item\n");
continue;
}
if (ioctl (fd,PPEXCL,0))
{
ERR("PPEXCL IOCTL rejected for device %s\n",buffer);
ERR("Check that PPDEV module is loaded!\n");
ERR("Perhaps the device is already in use or non-existant\n");
continue;
}
if (ioctl (fd,PPCLAIM,0))
{
ERR("PPCLAIM rejected %s\n",buffer);
@ -129,6 +122,12 @@ char IO_pp_init(void)
ERR("PPUSER IOCTL not available for parport device %s\n",temp);
continue;
}
if (ioctl (fd,PPRELEASE,0))
{
ERR("PPRELEASE rejected %s\n",buffer);
ERR("Perhaps the device is already in use or non-existant\n");
continue;
}
PPDeviceList[nports].devicename = malloc(sizeof(buffer)+1);
if (!PPDeviceList[nports].devicename)
{
@ -181,20 +180,22 @@ char IO_pp_init(void)
*/
static int IO_pp_do_access(int idx,int ppctl, DWORD* res)
{
if (!PPDeviceList[idx].lastaccess)
/* TIMER callback has released the device after some time of inactivity
Reclaim the device
!!!!!!THIS MAY UNINTERRUPTIPLE BLOCK IF SOME OTHER DEVICE
!!!!!! HAS CLAIMED THE SAME PORT
*/
if (ioctl(PPDeviceList[idx].fd,PPCLAIM,0))
{
ERR("Can't reclaim device %s, PPUSER/PPDEV handling confused\n",
PPDeviceList[idx].devicename);
return 1;
}
PPDeviceList[idx].lastaccess=GetTickCount();
return ioctl(PPDeviceList[idx].fd,ppctl,res);
int ret;
if (ioctl(PPDeviceList[idx].fd,PPCLAIM,0))
{
ERR("Can't reclaim device %s, PPUSER/PPDEV handling confused\n",
PPDeviceList[idx].devicename);
return 1;
}
ret = ioctl(PPDeviceList[idx].fd,ppctl,res);
if (ioctl(PPDeviceList[idx].fd,PPRELEASE,0))
{
ERR("Can't release device %s, PPUSER/PPDEV handling confused\n",
PPDeviceList[idx].devicename);
return 1;
}
return ret;
}
/* IO_pp_inp