Alessandro Premoli wrote:
Andreas Jellinghaus ha scritto:
This new version only fixes a few minor bugs:
* implement usb reset (Andrey Jivsov)
Only for linux:
ouch, true. didn't think of that, and noone tested openct
except on linux :(
please test with attached patch and let me know if it works.
of course the patch is stupid: only implementing "return -1;"
because I'm not sure if some or all BSD have an ioctl() for
usb_reset and what the syntax exactly would be. feedback is
very welcome.
Regards, Andreas
diff -udrNPp --exclude=.svn openct.orig/src/ifd/sys-bsd.c
openct/src/ifd/sys-bsd.c
--- openct.orig/src/ifd/sys-bsd.c 2006-11-01 22:07:25.000000000 +0100
+++ openct/src/ifd/sys-bsd.c 2006-11-13 20:18:03.000000000 +0100
@@ -315,6 +315,12 @@ int ifd_sysdep_usb_open(const char *devi
return open(device, O_RDWR);
}
+int ifd_sysdep_usb_reset(ifd_device_t * dev)
+{
+ /* not implemented so far */
+ return -1;
+}
+
/*
* Scan all usb devices to see if there is one we support
*/
diff -udrNPp --exclude=.svn openct.orig/src/ifd/sys-linux.c
openct/src/ifd/sys-linux.c
--- openct.orig/src/ifd/sys-linux.c 2006-11-06 23:21:02.000000000 +0100
+++ openct/src/ifd/sys-linux.c 2006-11-12 17:38:35.000000000 +0100
@@ -225,7 +225,7 @@ int ifd_sysdep_usb_release_interface(ifd
int ifd_sysdep_usb_reset(ifd_device_t * dev)
{
if (ioctl(dev->fd, USBDEVFS_RESET, NULL) < 0) {
- ct_error(40, "usb_reset failed: %m");
+ ct_error("usb_reset failed: %m");
return IFD_ERROR_COMM_ERROR;
}
return 0;
diff -udrNPp --exclude=.svn openct.orig/src/ifd/sys-null.c
openct/src/ifd/sys-null.c
--- openct.orig/src/ifd/sys-null.c 2006-09-13 09:12:02.000000000 +0200
+++ openct/src/ifd/sys-null.c 2006-11-13 20:12:03.000000000 +0100
@@ -98,6 +98,11 @@ int ifd_sysdep_usb_open(const char *devi
return -1;
}
+int ifd_sysdep_usb_reset(ifd_device_t * dev)
+{
+ return -1;
+}
+
/*
* Scan all usb devices to see if there is one we support
*/
diff -udrNPp --exclude=.svn openct.orig/src/ifd/sys-osx.c
openct/src/ifd/sys-osx.c
--- openct.orig/src/ifd/sys-osx.c 2006-09-13 09:12:02.000000000 +0200
+++ openct/src/ifd/sys-osx.c 2006-11-13 20:12:22.000000000 +0100
@@ -88,6 +88,11 @@ int ifd_sysdep_usb_open(const char *devi
return -1;
}
+int ifd_sysdep_usb_reset(const char *device)
+{
+ return -1;
+}
+
/*
* Scan all usb devices to see if there is one we support
*/
diff -udrNPp --exclude=.svn openct.orig/src/ifd/sys-solaris.c
openct/src/ifd/sys-solaris.c
--- openct.orig/src/ifd/sys-solaris.c 2006-09-13 09:12:02.000000000 +0200
+++ openct/src/ifd/sys-solaris.c 2006-11-13 20:12:56.000000000 +0100
@@ -504,6 +504,12 @@ int ifd_sysdep_usb_open(const char *devi
return open(device, O_RDWR);
}
+int ifd_sysdep_usb_reset(ifd_device_t * dev)
+{
+ /* not implemented so far */
+ return -1;
+}
+
/*
* Scan the /dev/usb directory to see if there is any control pipe matching:
*
diff -udrNPp --exclude=.svn openct.orig/src/ifd/sys-sunray.c
openct/src/ifd/sys-sunray.c
--- openct.orig/src/ifd/sys-sunray.c 2006-09-13 09:12:02.000000000 +0200
+++ openct/src/ifd/sys-sunray.c 2006-11-13 20:13:11.000000000 +0100
@@ -296,6 +296,12 @@ int ifd_sysdep_usb_open(const char *name
return ENOENT;
}
+int ifd_sysdep_usb_reset(ifd_device_t * dev)
+{
+ /* not implemented so far */
+ return -1;
+}
+
/*
* Scan all usb devices to see if there is one we support
*/
diff -udrNPp --exclude=.svn openct.orig/src/ifd/usb.c openct/src/ifd/usb.c
--- openct.orig/src/ifd/usb.c 2006-11-06 23:21:02.000000000 +0100
+++ openct/src/ifd/usb.c 2006-11-12 17:37:19.000000000 +0100
@@ -185,7 +185,7 @@ static struct ifd_device_ops ifd_usb_ops
ifd_device_t *ifd_open_usb(const char *device)
{
ifd_device_t *dev;
- int fd,rc;
+ int fd;
if ((fd = ifd_sysdep_usb_open(device)) < 0) {
ct_error("Unable to open USB device %s: %m", device);
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel