aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device/ClassDriver/CCID/CCID.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2018-06-29 19:37:23 +1000
committerGitHub <noreply@github.com>2018-06-29 19:37:23 +1000
commit941bc1470d9fe8857352facb56f7a250c1809933 (patch)
treee98406a2fbe9a10df2f186adcac27ab1a9d02568 /Demos/Device/ClassDriver/CCID/CCID.c
parentbc57f4ea5afd29f2e0f0175d14cf1540b4408de8 (diff)
parent1e9e7bc8b88af32f466f7438a06fb8dc96b3035d (diff)
downloadlufa-941bc1470d9fe8857352facb56f7a250c1809933.tar.gz
lufa-941bc1470d9fe8857352facb56f7a250c1809933.tar.bz2
lufa-941bc1470d9fe8857352facb56f7a250c1809933.zip
Merge pull request #131 from kidbomb/feature-ccid-xfrblock
CCID: Add support for PC-to-Reader XfrBlock message
Diffstat (limited to 'Demos/Device/ClassDriver/CCID/CCID.c')
-rw-r--r--Demos/Device/ClassDriver/CCID/CCID.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/Demos/Device/ClassDriver/CCID/CCID.c b/Demos/Device/ClassDriver/CCID/CCID.c
index 9059ad40d..bb4c11c45 100644
--- a/Demos/Device/ClassDriver/CCID/CCID.c
+++ b/Demos/Device/ClassDriver/CCID/CCID.c
@@ -213,6 +213,34 @@ uint8_t CALLBACK_CCID_GetSlotStatus(USB_ClassInfo_CCID_Device_t* const CCIDInter
}
}
+/** Event handler for the CCID_PC_to_RDR_XfrBlock. This message is sent to the device
+ * whenever an application at the host wants to send a block of bytes to the device
+ * THe device reply back with an array of bytes
+ */
+uint8_t CALLBACK_CCID_XfrBlock(USB_ClassInfo_CCID_Device_t* const CCIDInterfaceInfo,
+ uint8_t slot,
+ uint8_t* const receivedBuffer,
+ uint8_t receivedBufferSize,
+ uint8_t* const sendBuffer,
+ uint8_t* const sentBufferSize,
+ uint8_t* const error)
+{
+ if (slot < CCID_Interface.Config.TotalSlots)
+ {
+ uint8_t okResponse[2] = {0x90, 0x00};
+ memcpy(sendBuffer, okResponse, sizeof(okResponse));
+ *sentBufferSize = sizeof(okResponse);
+
+ *error = CCID_ERROR_NO_ERROR;
+ return CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR | CCID_ICCSTATUS_NOICCPRESENT;
+ }
+ else
+ {
+ *error = CCID_ERROR_SLOT_NOT_FOUND;
+ return CCID_COMMANDSTATUS_FAILED | CCID_ICCSTATUS_NOICCPRESENT;
+ }
+}
+
uint8_t CALLBACK_CCID_Abort(USB_ClassInfo_CCID_Device_t* const CCIDInterfaceInfo,
uint8_t slot,
uint8_t seq,