Hello,
I was thinking to implement the cyberJack PIN pad reader support.
Unfortunately, I ran into a problem when I must reset the reader with
usb_reset(device_handle). However, I don't see ifd_device_ops.reset
implemented. Is there a way to cleanly invoke the USB device reset
functionality?
I attached the patch that I think is needed. It would be nice to
integrate it into the tree.
Thank you.
Index: ifd/sys-linux.c
===================================================================
--- ifd/sys-linux.c (revision 48963)
+++ ifd/sys-linux.c (working copy)
@@ -289,6 +289,15 @@
return 0;
}
+int ifd_sysdep_usb_reset(ifd_device_t * dev)
+{
+ if (ioctl(dev->fd, USBDEVFS_RESET, NULL) < 0) {
+ ct_error(40, "usb_reset failed: %m");
+ return IFD_ERROR_COMM_ERROR;
+ }
+ return 0;
+}
+
/*
* USB bulk transfer
*/
Index: ifd/internal.h
===================================================================
--- ifd/internal.h (revision 48963)
+++ ifd/internal.h (working copy)
@@ -181,6 +182,7 @@
size_t, long);
extern int ifd_sysdep_usb_end_capture(ifd_device_t *, ifd_usb_capture_t * cap);
extern int ifd_sysdep_usb_open(const char *device);
+extern int ifd_sysdep_usb_reset(ifd_device_t *);
/* module.c */
extern int ifd_load_module(const char *, const char *);
Index: ifd/usb.c
===================================================================
--- ifd/usb.c (revision 48963)
+++ ifd/usb.c (working copy)
@@ -242,6 +242,17 @@
return rc;
}
+static int usb_reset(ifd_device_t * dev)
+{
+ int rc;
+
+ rc = ifd_sysdep_usb_reset( dev );
+
+ return rc;
+}
+
+
+
static struct ifd_device_ops ifd_usb_ops;
/*
@@ -263,6 +276,7 @@
ifd_usb_ops.set_params = usb_set_params;
ifd_usb_ops.send = usb_send;
ifd_usb_ops.recv = usb_recv;
+ ifd_usb_ops.reset = usb_reset;
dev = ifd_device_new(device, &ifd_usb_ops, sizeof(*dev));
dev->type = IFD_DEVICE_TYPE_USB;
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel