Allow multiple processes to fidle with the parallel port for ppdev
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Fri Jul 13 06:16:52 CDT 2001
Hallo,
the spde program with the dongle started new processes which also checked
the dongle. Those processes didn't see the dongle. Now it works
Changelog
msdos/ppdev.c: IO_pp_init,IO_pp_do_access
Don't claim the parport for exclusive access and release the port
after every access
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/msdos/ppdev.c
===================================================================
RCS file: /home/wine/wine/msdos/ppdev.c,v
retrieving revision 1.1
diff -u -r1.1 ppdev.c
--- wine/msdos/ppdev.c 2001/06/26 21:06:08 1.1
+++ wine/msdos/ppdev.c 2001/07/13 11:12:13
@@ -93,13 +93,6 @@
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 @@
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 @@
*/
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
More information about the wine-patches
mailing list