better fix for windrvrfd when device is not opened
prevents "!!!ERROR: magic header does not match!!!" message
This commit is contained in:
parent
979132fe59
commit
332ced7a9c
@ -40,8 +40,8 @@
|
|||||||
#include "usb-driver.h"
|
#include "usb-driver.h"
|
||||||
|
|
||||||
static int (*ioctl_func) (int, int, void *) = NULL;
|
static int (*ioctl_func) (int, int, void *) = NULL;
|
||||||
static int windrvrfd = 0;
|
static int windrvrfd = -1;
|
||||||
FILE *modulesfp;
|
FILE *modulesfp = NULL;
|
||||||
static int modules_read = 0;
|
static int modules_read = 0;
|
||||||
static struct usb_bus *busses = NULL;
|
static struct usb_bus *busses = NULL;
|
||||||
static struct usb_device *usbdevice;
|
static struct usb_device *usbdevice;
|
||||||
@ -660,7 +660,7 @@ int ioctl(int fd, int request, ...) {
|
|||||||
argp = va_arg (args, void *);
|
argp = va_arg (args, void *);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
if (windrvrfd && (fd == windrvrfd))
|
if (fd == windrvrfd)
|
||||||
ret = do_wdioctl(fd, request, argp);
|
ret = do_wdioctl(fd, request, argp);
|
||||||
else
|
else
|
||||||
ret = (*ioctl_func) (fd, request, argp);
|
ret = (*ioctl_func) (fd, request, argp);
|
||||||
@ -712,7 +712,7 @@ int close(int fd) {
|
|||||||
|
|
||||||
if (fd == windrvrfd) {
|
if (fd == windrvrfd) {
|
||||||
DPRINTF("close windrvrfd\n");
|
DPRINTF("close windrvrfd\n");
|
||||||
windrvrfd = 0;
|
windrvrfd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (*func) (fd);
|
return (*func) (fd);
|
||||||
|
Reference in New Issue
Block a user