FreeBSD Bugzilla – Attachment 55498 Details for
Bug 83863
[ugen] Communication problem between opensc/openct via USB with e-gate smart-card.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
egate_driver.c_snippet
egate_driver.c_snippet (text/plain), 2.47 KB, created by
Mohacsi Janos
on 2005-08-04 15:39:39 UTC
(
hide
)
Description:
egate_driver.c_snippet
Filename:
MIME Type:
Creator:
Mohacsi Janos
Created:
2005-08-04 15:39:39 UTC
Size:
2.47 KB
patch
obsolete
>/* > * Send/receive routines > */ >static int >eg_transparent(ifd_reader_t *reader, int dad, const void *inbuffer, size_t inlen, > void *outbuffer, size_t outlen) >{ > int rc; > unsigned char stat; > ifd_iso_apdu_t iso; > unsigned char cmdbuf[5]; > > stat=eg_status(reader); > if (stat != EGATE_STATUS_READY) { > ifd_debug(2, "device not ready, attempting reset"); > rc = ifd_usb_control(reader->device, EGATE_DIR_OUT, EGATE_CMD_RESET, > 0, 0, NULL, 0, EG_TIMEOUT); > if (rc < 0) > return IFD_ERROR_COMM_ERROR; > } > if (ifd_iso_apdu_parse(inbuffer, inlen, &iso) < 0) > return IFD_ERROR_INVALID_ARG; > if (inlen >= 5 && inlen < 5 + iso.lc) > return IFD_ERROR_BUFFER_TOO_SMALL; > if (outlen < 2 + iso.le) > return IFD_ERROR_BUFFER_TOO_SMALL; > memset(cmdbuf,0,5); > memmove(cmdbuf, inbuffer, inlen < 5 ? inlen : 5); > rc=ifd_usb_control(reader->device, EGATE_DIR_OUT, EGATE_CMD_SEND_APDU, > 0, 0, (void *) cmdbuf, 5, -1); > if (rc != 5) > return IFD_ERROR_COMM_ERROR; > stat=eg_status(reader); > if (inlen > 5 && stat == EGATE_STATUS_DATA) { > rc=ifd_usb_control(reader->device, EGATE_DIR_OUT, EGATE_CMD_WRITE, > 0, 0, (void *) (((unsigned char *)inbuffer)+5), iso.lc, -1); > if (rc < 0) > return IFD_ERROR_COMM_ERROR; > if (rc != iso.lc) { > ifd_debug(1, "short USB write (%u of %u bytes)", rc, iso.lc); > return IFD_ERROR_COMM_ERROR; > } > ifd_debug(3, "sent %d bytes of data", iso.lc); > stat=eg_status(reader); > } > if (stat == EGATE_STATUS_DATA) { > rc=ifd_usb_control(reader->device, EGATE_DIR_IN, EGATE_CMD_READ, 0, 0, > (void *) outbuffer, iso.le, EG_TIMEOUT); > if (rc < 0) > return IFD_ERROR_COMM_ERROR; > if (rc != iso.le) { > ifd_debug(1, "short USB read (%u of %u bytes)", rc, iso.le); > return IFD_ERROR_COMM_ERROR; > } > ifd_debug(3, "received %d bytes of data", iso.le); > stat=eg_status(reader); > } else > iso.le=0; > if (stat != EGATE_STATUS_SW) > return IFD_ERROR_DEVICE_DISCONNECTED; > rc=ifd_usb_control(reader->device, EGATE_DIR_IN, EGATE_CMD_READ, 0, 0, > (void *) (((unsigned char *)outbuffer)+iso.le), 2, EG_TIMEOUT); > if (rc != 2) > return IFD_ERROR_COMM_ERROR; > ifd_debug(2, "returning a %d byte response", iso.le + 2); > return iso.le+2; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 83863
: 55498 |
55499
|
55500