Library to allo USB PTP device to be hosted by the mbed platform
Dependents: class_project_main
USBHostPTP.cpp@0:98cf19bcd828, 2013-08-23 (annotated)
- Committer:
- jakowisp
- Date:
- Fri Aug 23 00:52:52 2013 +0000
- Revision:
- 0:98cf19bcd828
- Child:
- 1:71c0e9dc153d
Fix for a buffer overrun and refactored the Tranactoion code.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jakowisp | 0:98cf19bcd828 | 1 | /* mbed USBHost Library |
jakowisp | 0:98cf19bcd828 | 2 | * Copyright (c) 2006-2013 ARM Limited |
jakowisp | 0:98cf19bcd828 | 3 | * |
jakowisp | 0:98cf19bcd828 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
jakowisp | 0:98cf19bcd828 | 5 | * you may not use this file except in compliance with the License. |
jakowisp | 0:98cf19bcd828 | 6 | * You may obtain a copy of the License at |
jakowisp | 0:98cf19bcd828 | 7 | * |
jakowisp | 0:98cf19bcd828 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
jakowisp | 0:98cf19bcd828 | 9 | * |
jakowisp | 0:98cf19bcd828 | 10 | * Unless required by applicable law or agreed to in writing, software |
jakowisp | 0:98cf19bcd828 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
jakowisp | 0:98cf19bcd828 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
jakowisp | 0:98cf19bcd828 | 13 | * See the License for the specific language governing permissions and |
jakowisp | 0:98cf19bcd828 | 14 | * limitations under the License. |
jakowisp | 0:98cf19bcd828 | 15 | */ |
jakowisp | 0:98cf19bcd828 | 16 | |
jakowisp | 0:98cf19bcd828 | 17 | #include "USBHostPTP.h" |
jakowisp | 0:98cf19bcd828 | 18 | |
jakowisp | 0:98cf19bcd828 | 19 | #if 1 |
jakowisp | 0:98cf19bcd828 | 20 | //USBHOST_PTP |
jakowisp | 0:98cf19bcd828 | 21 | |
jakowisp | 0:98cf19bcd828 | 22 | #include "dbg.h" |
jakowisp | 0:98cf19bcd828 | 23 | |
jakowisp | 0:98cf19bcd828 | 24 | #define DEVICE_TO_HOST 0x80 |
jakowisp | 0:98cf19bcd828 | 25 | #define HOST_TO_DEVICE 0x00 |
jakowisp | 0:98cf19bcd828 | 26 | |
jakowisp | 0:98cf19bcd828 | 27 | |
jakowisp | 0:98cf19bcd828 | 28 | USBHostPTP::USBHostPTP( void ) |
jakowisp | 0:98cf19bcd828 | 29 | { |
jakowisp | 0:98cf19bcd828 | 30 | host = USBHost::getHostInst(); |
jakowisp | 0:98cf19bcd828 | 31 | initializeClassData(); |
jakowisp | 0:98cf19bcd828 | 32 | } |
jakowisp | 0:98cf19bcd828 | 33 | |
jakowisp | 0:98cf19bcd828 | 34 | void USBHostPTP::initializeClassData() { |
jakowisp | 0:98cf19bcd828 | 35 | deviceConnected = false; |
jakowisp | 0:98cf19bcd828 | 36 | pointerToDevice = NULL; |
jakowisp | 0:98cf19bcd828 | 37 | bulk_in = NULL; |
jakowisp | 0:98cf19bcd828 | 38 | bulk_out = NULL; |
jakowisp | 0:98cf19bcd828 | 39 | int_in=NULL; |
jakowisp | 0:98cf19bcd828 | 40 | deviceFound = false; |
jakowisp | 0:98cf19bcd828 | 41 | deviceConnected = false; |
jakowisp | 0:98cf19bcd828 | 42 | ptp_intf = -1; |
jakowisp | 0:98cf19bcd828 | 43 | numberOfEndpoints = 0; |
jakowisp | 0:98cf19bcd828 | 44 | transactionCnt=0; |
jakowisp | 0:98cf19bcd828 | 45 | commandContainer.type=PTP_USB_CONTAINER_COMMAND; |
jakowisp | 0:98cf19bcd828 | 46 | sessionID=1; |
jakowisp | 0:98cf19bcd828 | 47 | dataLeftToTransfer=0; |
jakowisp | 0:98cf19bcd828 | 48 | } |
jakowisp | 0:98cf19bcd828 | 49 | |
jakowisp | 0:98cf19bcd828 | 50 | |
jakowisp | 0:98cf19bcd828 | 51 | bool USBHostPTP::connected() |
jakowisp | 0:98cf19bcd828 | 52 | { |
jakowisp | 0:98cf19bcd828 | 53 | return deviceConnected; |
jakowisp | 0:98cf19bcd828 | 54 | } |
jakowisp | 0:98cf19bcd828 | 55 | |
jakowisp | 0:98cf19bcd828 | 56 | bool USBHostPTP::connect() |
jakowisp | 0:98cf19bcd828 | 57 | { |
jakowisp | 0:98cf19bcd828 | 58 | |
jakowisp | 0:98cf19bcd828 | 59 | if (deviceConnected) { |
jakowisp | 0:98cf19bcd828 | 60 | return true; |
jakowisp | 0:98cf19bcd828 | 61 | } |
jakowisp | 0:98cf19bcd828 | 62 | |
jakowisp | 0:98cf19bcd828 | 63 | for (uint8_t i = 0; i < MAX_DEVICE_CONNECTED; i++) { |
jakowisp | 0:98cf19bcd828 | 64 | if ((pointerToDevice = host->getDevice(i)) != NULL) { |
jakowisp | 0:98cf19bcd828 | 65 | |
jakowisp | 0:98cf19bcd828 | 66 | USB_DBG("Trying to connect PTP device\r\n"); |
jakowisp | 0:98cf19bcd828 | 67 | |
jakowisp | 0:98cf19bcd828 | 68 | if(host->enumerate(pointerToDevice, this)) |
jakowisp | 0:98cf19bcd828 | 69 | break; |
jakowisp | 0:98cf19bcd828 | 70 | |
jakowisp | 0:98cf19bcd828 | 71 | if (deviceFound) { |
jakowisp | 0:98cf19bcd828 | 72 | bulk_in = pointerToDevice->getEndpoint(ptp_intf, BULK_ENDPOINT, IN); |
jakowisp | 0:98cf19bcd828 | 73 | bulk_out = pointerToDevice->getEndpoint(ptp_intf, BULK_ENDPOINT, OUT); |
jakowisp | 0:98cf19bcd828 | 74 | int_in = pointerToDevice->getEndpoint(ptp_intf, INTERRUPT_ENDPOINT, IN); |
jakowisp | 0:98cf19bcd828 | 75 | |
jakowisp | 0:98cf19bcd828 | 76 | if (!bulk_in || !bulk_out || !int_in) |
jakowisp | 0:98cf19bcd828 | 77 | continue; |
jakowisp | 0:98cf19bcd828 | 78 | |
jakowisp | 0:98cf19bcd828 | 79 | USB_INFO("New PTP device: VID:%04x PID:%04x [dev: %p - intf: %d]", pointerToDevice->getVid(), |
jakowisp | 0:98cf19bcd828 | 80 | pointerToDevice->getPid(), |
jakowisp | 0:98cf19bcd828 | 81 | pointerToDevice, ptp_intf); |
jakowisp | 0:98cf19bcd828 | 82 | pointerToDevice->setName("PTP", ptp_intf); |
jakowisp | 0:98cf19bcd828 | 83 | host->registerDriver(pointerToDevice, ptp_intf, this, &USBHostPTP::initializeClassData); |
jakowisp | 0:98cf19bcd828 | 84 | |
jakowisp | 0:98cf19bcd828 | 85 | deviceConnected = true; |
jakowisp | 0:98cf19bcd828 | 86 | return true; |
jakowisp | 0:98cf19bcd828 | 87 | } |
jakowisp | 0:98cf19bcd828 | 88 | } //if() |
jakowisp | 0:98cf19bcd828 | 89 | } //for() |
jakowisp | 0:98cf19bcd828 | 90 | initializeClassData(); |
jakowisp | 0:98cf19bcd828 | 91 | return false; |
jakowisp | 0:98cf19bcd828 | 92 | } |
jakowisp | 0:98cf19bcd828 | 93 | |
jakowisp | 0:98cf19bcd828 | 94 | /*virtual*/ void USBHostPTP::setVidPid(uint16_t vid, uint16_t pid) |
jakowisp | 0:98cf19bcd828 | 95 | { |
jakowisp | 0:98cf19bcd828 | 96 | // we don't check VID/PID for PTP driver |
jakowisp | 0:98cf19bcd828 | 97 | } |
jakowisp | 0:98cf19bcd828 | 98 | |
jakowisp | 0:98cf19bcd828 | 99 | /*virtual*/ bool USBHostPTP::parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol) //Must return true if the interface should be parsed |
jakowisp | 0:98cf19bcd828 | 100 | { |
jakowisp | 0:98cf19bcd828 | 101 | |
jakowisp | 0:98cf19bcd828 | 102 | if ((ptp_intf == -1) && |
jakowisp | 0:98cf19bcd828 | 103 | (intf_class == USB_PTP_CLASS_CODE) && |
jakowisp | 0:98cf19bcd828 | 104 | (intf_subclass == 0x01) && |
jakowisp | 0:98cf19bcd828 | 105 | (intf_protocol == 0x01)) { |
jakowisp | 0:98cf19bcd828 | 106 | ptp_intf = intf_nb; |
jakowisp | 0:98cf19bcd828 | 107 | return true; |
jakowisp | 0:98cf19bcd828 | 108 | } |
jakowisp | 0:98cf19bcd828 | 109 | return false; |
jakowisp | 0:98cf19bcd828 | 110 | } |
jakowisp | 0:98cf19bcd828 | 111 | |
jakowisp | 0:98cf19bcd828 | 112 | /*virtual*/ bool USBHostPTP::useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir) //Must return true if the endpoint will be used |
jakowisp | 0:98cf19bcd828 | 113 | { |
jakowisp | 0:98cf19bcd828 | 114 | |
jakowisp | 0:98cf19bcd828 | 115 | if (intf_nb == ptp_intf) { |
jakowisp | 0:98cf19bcd828 | 116 | if (type == INTERRUPT_ENDPOINT) { |
jakowisp | 0:98cf19bcd828 | 117 | numberOfEndpoints++; |
jakowisp | 0:98cf19bcd828 | 118 | } |
jakowisp | 0:98cf19bcd828 | 119 | if (type == BULK_ENDPOINT) { |
jakowisp | 0:98cf19bcd828 | 120 | numberOfEndpoints++; |
jakowisp | 0:98cf19bcd828 | 121 | } |
jakowisp | 0:98cf19bcd828 | 122 | if (numberOfEndpoints == 3) |
jakowisp | 0:98cf19bcd828 | 123 | deviceFound = true; |
jakowisp | 0:98cf19bcd828 | 124 | return true; |
jakowisp | 0:98cf19bcd828 | 125 | } |
jakowisp | 0:98cf19bcd828 | 126 | return false; |
jakowisp | 0:98cf19bcd828 | 127 | } |
jakowisp | 0:98cf19bcd828 | 128 | |
jakowisp | 0:98cf19bcd828 | 129 | |
jakowisp | 0:98cf19bcd828 | 130 | |
jakowisp | 0:98cf19bcd828 | 131 | |
jakowisp | 0:98cf19bcd828 | 132 | |
jakowisp | 0:98cf19bcd828 | 133 | |
jakowisp | 0:98cf19bcd828 | 134 | |
jakowisp | 0:98cf19bcd828 | 135 | |
jakowisp | 0:98cf19bcd828 | 136 | bool USBHostPTP::CancelRequest(unsigned int TransactionID) { |
jakowisp | 0:98cf19bcd828 | 137 | unsigned char buffer[6]; |
jakowisp | 0:98cf19bcd828 | 138 | int res = 0; |
jakowisp | 0:98cf19bcd828 | 139 | |
jakowisp | 0:98cf19bcd828 | 140 | buffer[0] =0x01; //Cancellation Code 0x4001 |
jakowisp | 0:98cf19bcd828 | 141 | buffer[1] =0x40; |
jakowisp | 0:98cf19bcd828 | 142 | buffer[2]= TransactionID & 0xff; |
jakowisp | 0:98cf19bcd828 | 143 | buffer[3]= (TransactionID>>8) & 0xff; |
jakowisp | 0:98cf19bcd828 | 144 | buffer[4]= (TransactionID>>16) & 0xff;; |
jakowisp | 0:98cf19bcd828 | 145 | buffer[5]= (TransactionID>>24) & 0xff;; |
jakowisp | 0:98cf19bcd828 | 146 | |
jakowisp | 0:98cf19bcd828 | 147 | res = host->controlWrite( pointerToDevice, |
jakowisp | 0:98cf19bcd828 | 148 | USB_RECIPIENT_ENDPOINT | USB_HOST_TO_DEVICE | USB_REQUEST_TYPE_STANDARD, |
jakowisp | 0:98cf19bcd828 | 149 | USB_PTP_CLASS_REQUEST_CANCELREQEUST, |
jakowisp | 0:98cf19bcd828 | 150 | 0, 0, buffer, 6); |
jakowisp | 0:98cf19bcd828 | 151 | return res==0?true:false; |
jakowisp | 0:98cf19bcd828 | 152 | } |
jakowisp | 0:98cf19bcd828 | 153 | |
jakowisp | 0:98cf19bcd828 | 154 | bool USBHostPTP::DeviceResetRequest(void) { |
jakowisp | 0:98cf19bcd828 | 155 | |
jakowisp | 0:98cf19bcd828 | 156 | int res = 0; |
jakowisp | 0:98cf19bcd828 | 157 | |
jakowisp | 0:98cf19bcd828 | 158 | res = host->controlWrite( pointerToDevice, |
jakowisp | 0:98cf19bcd828 | 159 | USB_RECIPIENT_ENDPOINT | USB_HOST_TO_DEVICE | USB_REQUEST_TYPE_STANDARD, |
jakowisp | 0:98cf19bcd828 | 160 | USB_PTP_CLASS_REQUEST_DEVICE_RESET, |
jakowisp | 0:98cf19bcd828 | 161 | 0, 0, NULL, 0); |
jakowisp | 0:98cf19bcd828 | 162 | return res==0?true:false; |
jakowisp | 0:98cf19bcd828 | 163 | } |
jakowisp | 0:98cf19bcd828 | 164 | |
jakowisp | 0:98cf19bcd828 | 165 | |
jakowisp | 0:98cf19bcd828 | 166 | bool USBHostPTP::GetDeviceStatus(void) { |
jakowisp | 0:98cf19bcd828 | 167 | unsigned char buffer[6]; |
jakowisp | 0:98cf19bcd828 | 168 | int res = 0; |
jakowisp | 0:98cf19bcd828 | 169 | |
jakowisp | 0:98cf19bcd828 | 170 | //TODO: DetermineBuffer size |
jakowisp | 0:98cf19bcd828 | 171 | |
jakowisp | 0:98cf19bcd828 | 172 | res = host->controlWrite( pointerToDevice, |
jakowisp | 0:98cf19bcd828 | 173 | USB_RECIPIENT_ENDPOINT | USB_HOST_TO_DEVICE | USB_REQUEST_TYPE_STANDARD, |
jakowisp | 0:98cf19bcd828 | 174 | USB_PTP_CLASS_REQUEST_GET_DEVICE_STATUS, |
jakowisp | 0:98cf19bcd828 | 175 | 0, 0, buffer, sizeof(buffer)); |
jakowisp | 0:98cf19bcd828 | 176 | return res==0?true:false; |
jakowisp | 0:98cf19bcd828 | 177 | } |
jakowisp | 0:98cf19bcd828 | 178 | |
jakowisp | 0:98cf19bcd828 | 179 | bool USBHostPTP::GetExtendedEventData(void) { |
jakowisp | 0:98cf19bcd828 | 180 | unsigned char buffer[6]; |
jakowisp | 0:98cf19bcd828 | 181 | int res = 0; |
jakowisp | 0:98cf19bcd828 | 182 | |
jakowisp | 0:98cf19bcd828 | 183 | //TODO: DetermineBuffer size |
jakowisp | 0:98cf19bcd828 | 184 | |
jakowisp | 0:98cf19bcd828 | 185 | res = host->controlWrite( pointerToDevice, |
jakowisp | 0:98cf19bcd828 | 186 | USB_RECIPIENT_ENDPOINT | USB_HOST_TO_DEVICE | USB_REQUEST_TYPE_STANDARD, |
jakowisp | 0:98cf19bcd828 | 187 | USB_PTP_CLASS_REQUEST_GET_EXTENDED_EVENT_DATA, |
jakowisp | 0:98cf19bcd828 | 188 | 0, 0, buffer, sizeof(buffer)); |
jakowisp | 0:98cf19bcd828 | 189 | return res==0?true:false; |
jakowisp | 0:98cf19bcd828 | 190 | } |
jakowisp | 0:98cf19bcd828 | 191 | |
jakowisp | 0:98cf19bcd828 | 192 | bool USBHostPTP::CheckEvent(){ |
jakowisp | 0:98cf19bcd828 | 193 | int res=0; |
jakowisp | 0:98cf19bcd828 | 194 | |
jakowisp | 0:98cf19bcd828 | 195 | memset(&eventContainer, 0, sizeof(PIMAContainer)); |
jakowisp | 0:98cf19bcd828 | 196 | |
jakowisp | 0:98cf19bcd828 | 197 | res = host->interruptRead(pointerToDevice, int_in,(uint8_t *)&eventContainer, sizeof(PIMAContainer)); |
jakowisp | 0:98cf19bcd828 | 198 | |
jakowisp | 0:98cf19bcd828 | 199 | if(res!=USB_TYPE_OK) |
jakowisp | 0:98cf19bcd828 | 200 | return false; |
jakowisp | 0:98cf19bcd828 | 201 | |
jakowisp | 0:98cf19bcd828 | 202 | return true; |
jakowisp | 0:98cf19bcd828 | 203 | } |
jakowisp | 0:98cf19bcd828 | 204 | |
jakowisp | 0:98cf19bcd828 | 205 | int USBHostPTP::checkResult(uint8_t res, USBEndpoint * ep) { |
jakowisp | 0:98cf19bcd828 | 206 | // if ep stalled: send clear feature |
jakowisp | 0:98cf19bcd828 | 207 | if (res == USB_TYPE_STALL_ERROR) { |
jakowisp | 0:98cf19bcd828 | 208 | res = host->controlWrite( pointerToDevice, |
jakowisp | 0:98cf19bcd828 | 209 | USB_RECIPIENT_ENDPOINT | USB_HOST_TO_DEVICE | USB_REQUEST_TYPE_STANDARD, |
jakowisp | 0:98cf19bcd828 | 210 | CLEAR_FEATURE, |
jakowisp | 0:98cf19bcd828 | 211 | 0, ep->getAddress(), NULL, 0); |
jakowisp | 0:98cf19bcd828 | 212 | // set state to IDLE if clear feature successful |
jakowisp | 0:98cf19bcd828 | 213 | if (res == USB_TYPE_OK) { |
jakowisp | 0:98cf19bcd828 | 214 | ep->setState(USB_TYPE_IDLE); |
jakowisp | 0:98cf19bcd828 | 215 | } |
jakowisp | 0:98cf19bcd828 | 216 | } |
jakowisp | 0:98cf19bcd828 | 217 | |
jakowisp | 0:98cf19bcd828 | 218 | if (res != USB_TYPE_OK) |
jakowisp | 0:98cf19bcd828 | 219 | return -1; |
jakowisp | 0:98cf19bcd828 | 220 | |
jakowisp | 0:98cf19bcd828 | 221 | return 0; |
jakowisp | 0:98cf19bcd828 | 222 | } |
jakowisp | 0:98cf19bcd828 | 223 | |
jakowisp | 0:98cf19bcd828 | 224 | |
jakowisp | 0:98cf19bcd828 | 225 | uint16_t USBHostPTP::Transaction(uint16_t operationCode, |
jakowisp | 0:98cf19bcd828 | 226 | OperFlags *operationFlags, |
jakowisp | 0:98cf19bcd828 | 227 | uint32_t *parameters, |
jakowisp | 0:98cf19bcd828 | 228 | void *dataHandlerFunctionCastToVoid){ |
jakowisp | 0:98cf19bcd828 | 229 | |
jakowisp | 0:98cf19bcd828 | 230 | |
jakowisp | 0:98cf19bcd828 | 231 | int transferResult=0; |
jakowisp | 0:98cf19bcd828 | 232 | int i=0; |
jakowisp | 0:98cf19bcd828 | 233 | uint8_t *pointerToUint8tData; |
jakowisp | 0:98cf19bcd828 | 234 | uint32_t bytesReceived=0; |
jakowisp | 0:98cf19bcd828 | 235 | uint32_t bytesRemaining=0; |
jakowisp | 0:98cf19bcd828 | 236 | uint32_t dataToBeHandled=0; |
jakowisp | 0:98cf19bcd828 | 237 | uint32_t responseLength=0; |
jakowisp | 0:98cf19bcd828 | 238 | DataHandler dataHandler1 = (DataHandler) dataHandlerFunctionCastToVoid; |
jakowisp | 0:98cf19bcd828 | 239 | bool firstDataBlockReceived=true; |
jakowisp | 0:98cf19bcd828 | 240 | |
jakowisp | 0:98cf19bcd828 | 241 | if(IsCommandSupported(operationCode)==false) |
jakowisp | 0:98cf19bcd828 | 242 | return PIMAReturnCodeOperationNotSupported; |
jakowisp | 0:98cf19bcd828 | 243 | |
jakowisp | 0:98cf19bcd828 | 244 | commandContainer.len = PIMAContainerHeaderLength + operationFlags->opParams*4; |
jakowisp | 0:98cf19bcd828 | 245 | responseLength = PIMAContainerHeaderLength + operationFlags->rsParams*4; |
jakowisp | 0:98cf19bcd828 | 246 | responseContainer.len = responseLength; |
jakowisp | 0:98cf19bcd828 | 247 | commandContainer.opcode = operationCode; |
jakowisp | 0:98cf19bcd828 | 248 | commandContainer.TransactionID = transactionCnt++; |
jakowisp | 0:98cf19bcd828 | 249 | for (i=0; i<operationFlags->opParams; i++) |
jakowisp | 0:98cf19bcd828 | 250 | commandContainer.param[i]=parameters[i]; |
jakowisp | 0:98cf19bcd828 | 251 | |
jakowisp | 0:98cf19bcd828 | 252 | #ifdef USDBPTPDEBUG |
jakowisp | 0:98cf19bcd828 | 253 | printf("PTPCommandContainer:\r\n"); |
jakowisp | 0:98cf19bcd828 | 254 | DumpBuffer((uint8_t *)&commandContainer,commandContainer.len); |
jakowisp | 0:98cf19bcd828 | 255 | #endif |
jakowisp | 0:98cf19bcd828 | 256 | |
jakowisp | 0:98cf19bcd828 | 257 | transferResult = host->bulkWrite(pointerToDevice, bulk_out,(uint8_t *)&commandContainer, commandContainer.len); |
jakowisp | 0:98cf19bcd828 | 258 | if (checkResult(transferResult, bulk_out)) |
jakowisp | 0:98cf19bcd828 | 259 | return PIMAReturnCodeIncompleteTransfer; |
jakowisp | 0:98cf19bcd828 | 260 | #ifdef USDBPTPDEBUG |
jakowisp | 0:98cf19bcd828 | 261 | printf("Command bulkWrite result: %d\r\n",transferResult); |
jakowisp | 0:98cf19bcd828 | 262 | #endif |
jakowisp | 0:98cf19bcd828 | 263 | if(operationFlags->dataStage==1) { |
jakowisp | 0:98cf19bcd828 | 264 | if(operationFlags->txOperation==0) { |
jakowisp | 0:98cf19bcd828 | 265 | do { |
jakowisp | 0:98cf19bcd828 | 266 | transferResult = host->bulkRead(pointerToDevice, bulk_in, buffer, 1024); |
jakowisp | 0:98cf19bcd828 | 267 | #ifdef USDBPTPDEBUG |
jakowisp | 0:98cf19bcd828 | 268 | printf("Data stage bulkRead result: %d\r\n",transferResult); |
jakowisp | 0:98cf19bcd828 | 269 | #endif |
jakowisp | 0:98cf19bcd828 | 270 | if ( checkResult(transferResult, bulk_in)) |
jakowisp | 0:98cf19bcd828 | 271 | return PIMAReturnCodeIncompleteTransfer; |
jakowisp | 0:98cf19bcd828 | 272 | bytesReceived = bulk_in->getLengthTransferred(); |
jakowisp | 0:98cf19bcd828 | 273 | if(firstDataBlockReceived==true) { |
jakowisp | 0:98cf19bcd828 | 274 | pointerToUint8tData=(uint8_t *)&dataContainer; |
jakowisp | 0:98cf19bcd828 | 275 | for(i=0; i<PIMAContainerHeaderLength; i++){ |
jakowisp | 0:98cf19bcd828 | 276 | pointerToUint8tData[i]=buffer[i]; |
jakowisp | 0:98cf19bcd828 | 277 | } |
jakowisp | 0:98cf19bcd828 | 278 | #ifdef USDBPTPDEBUG |
jakowisp | 0:98cf19bcd828 | 279 | DumpBuffer(pointerToUint8tData,PIMAContainerHeaderLength); |
jakowisp | 0:98cf19bcd828 | 280 | #endif |
jakowisp | 0:98cf19bcd828 | 281 | firstDataBlockReceived = false; |
jakowisp | 0:98cf19bcd828 | 282 | pointerToUint8tData = buffer+PIMAContainerHeaderLength; |
jakowisp | 0:98cf19bcd828 | 283 | bytesRemaining = dataContainer.len - PIMAContainerHeaderLength; |
jakowisp | 0:98cf19bcd828 | 284 | this->totalDataToTransfer = bytesRemaining; |
jakowisp | 0:98cf19bcd828 | 285 | if(dataContainer.type==0x0002) |
jakowisp | 0:98cf19bcd828 | 286 | bytesReceived -= PIMAContainerHeaderLength; |
jakowisp | 0:98cf19bcd828 | 287 | #ifdef USDBPTPDEBUG |
jakowisp | 0:98cf19bcd828 | 288 | DumpBuffer(pointerToUint8tData,bytesReceived); |
jakowisp | 0:98cf19bcd828 | 289 | #endif |
jakowisp | 0:98cf19bcd828 | 290 | } else { |
jakowisp | 0:98cf19bcd828 | 291 | pointerToUint8tData=buffer; |
jakowisp | 0:98cf19bcd828 | 292 | } |
jakowisp | 0:98cf19bcd828 | 293 | |
jakowisp | 0:98cf19bcd828 | 294 | if(bytesReceived<=bytesRemaining) |
jakowisp | 0:98cf19bcd828 | 295 | dataToBeHandled=bytesReceived; |
jakowisp | 0:98cf19bcd828 | 296 | else { |
jakowisp | 0:98cf19bcd828 | 297 | dataToBeHandled=bytesRemaining; |
jakowisp | 0:98cf19bcd828 | 298 | } |
jakowisp | 0:98cf19bcd828 | 299 | |
jakowisp | 0:98cf19bcd828 | 300 | #ifdef USDBPTPDEBUG |
jakowisp | 0:98cf19bcd828 | 301 | printf("Calling Datahandler\r\n"); |
jakowisp | 0:98cf19bcd828 | 302 | printf("DataToBeHandled: %ld\r\n",dataToBeHandled); |
jakowisp | 0:98cf19bcd828 | 303 | #endif |
jakowisp | 0:98cf19bcd828 | 304 | if( dataHandler1!=NULL && dataToBeHandled !=0 ) |
jakowisp | 0:98cf19bcd828 | 305 | (*dataHandler1)(this,pointerToUint8tData,dataToBeHandled); |
jakowisp | 0:98cf19bcd828 | 306 | |
jakowisp | 0:98cf19bcd828 | 307 | #ifdef USDBPTPDEBUG |
jakowisp | 0:98cf19bcd828 | 308 | DumpBuffer(buffer,bytesReceived); |
jakowisp | 0:98cf19bcd828 | 309 | #endif |
jakowisp | 0:98cf19bcd828 | 310 | |
jakowisp | 0:98cf19bcd828 | 311 | //IF the Response got appended to Data block |
jakowisp | 0:98cf19bcd828 | 312 | if(bytesReceived<=bytesRemaining) { |
jakowisp | 0:98cf19bcd828 | 313 | bytesRemaining-=bytesReceived; |
jakowisp | 0:98cf19bcd828 | 314 | } else { |
jakowisp | 0:98cf19bcd828 | 315 | #ifdef USDBPTPDEBUG |
jakowisp | 0:98cf19bcd828 | 316 | printf("Handling Response Packet in data container\r\n"); |
jakowisp | 0:98cf19bcd828 | 317 | #endif |
jakowisp | 0:98cf19bcd828 | 318 | if(bytesReceived-bytesRemaining==responseLength) { |
jakowisp | 0:98cf19bcd828 | 319 | pointerToUint8tData=(uint8_t *)&responseContainer; |
jakowisp | 0:98cf19bcd828 | 320 | for(i=0;i<responseLength;i++){ |
jakowisp | 0:98cf19bcd828 | 321 | pointerToUint8tData[i]=buffer[bytesRemaining+i]; |
jakowisp | 0:98cf19bcd828 | 322 | } |
jakowisp | 0:98cf19bcd828 | 323 | |
jakowisp | 0:98cf19bcd828 | 324 | return responseContainer.opcode; |
jakowisp | 0:98cf19bcd828 | 325 | } else { |
jakowisp | 0:98cf19bcd828 | 326 | |
jakowisp | 0:98cf19bcd828 | 327 | return PIMAReturnCodeIncompleteTransfer; |
jakowisp | 0:98cf19bcd828 | 328 | } |
jakowisp | 0:98cf19bcd828 | 329 | } |
jakowisp | 0:98cf19bcd828 | 330 | this->dataLeftToTransfer = bytesRemaining; |
jakowisp | 0:98cf19bcd828 | 331 | #ifdef USDBPTPDEBUG |
jakowisp | 0:98cf19bcd828 | 332 | printf("Loopcheck: %ld\r\n",bytesRemaining); |
jakowisp | 0:98cf19bcd828 | 333 | #endif |
jakowisp | 0:98cf19bcd828 | 334 | } while( bytesRemaining>0 ); |
jakowisp | 0:98cf19bcd828 | 335 | } else { |
jakowisp | 0:98cf19bcd828 | 336 | printf("DataOut not coded\r\n"); |
jakowisp | 0:98cf19bcd828 | 337 | } |
jakowisp | 0:98cf19bcd828 | 338 | } |
jakowisp | 0:98cf19bcd828 | 339 | transferResult = host->bulkRead(pointerToDevice, bulk_in,(uint8_t *)&responseContainer, sizeof(responseContainer)); |
jakowisp | 0:98cf19bcd828 | 340 | if (checkResult(transferResult, bulk_in)) |
jakowisp | 0:98cf19bcd828 | 341 | return PIMAReturnCodeIncompleteTransfer; |
jakowisp | 0:98cf19bcd828 | 342 | #ifdef USDBPTPDEBUG |
jakowisp | 0:98cf19bcd828 | 343 | printf("Response bulkRead result: %d\r\n",transferResult); |
jakowisp | 0:98cf19bcd828 | 344 | printf("PTPResponseContainer:\r\n"); |
jakowisp | 0:98cf19bcd828 | 345 | DumpBuffer((uint8_t *)&responseContainer,responseContainer.len); |
jakowisp | 0:98cf19bcd828 | 346 | if(responseContainer.opcode==PIMAReturnCodeOK) { |
jakowisp | 0:98cf19bcd828 | 347 | printf("PIMAReturnCodeOK\r\n"); |
jakowisp | 0:98cf19bcd828 | 348 | } else { |
jakowisp | 0:98cf19bcd828 | 349 | printf("Response Length: %x\r\n",responseContainer.len); |
jakowisp | 0:98cf19bcd828 | 350 | printf("Response type: %x\r\n",responseContainer.type); |
jakowisp | 0:98cf19bcd828 | 351 | printf("Response code: %x\r\n",responseContainer.opcode); |
jakowisp | 0:98cf19bcd828 | 352 | printf("Response ID: %d\r\n",responseContainer.TransactionID); |
jakowisp | 0:98cf19bcd828 | 353 | } |
jakowisp | 0:98cf19bcd828 | 354 | #endif |
jakowisp | 0:98cf19bcd828 | 355 | |
jakowisp | 0:98cf19bcd828 | 356 | return responseContainer.opcode; |
jakowisp | 0:98cf19bcd828 | 357 | } |
jakowisp | 0:98cf19bcd828 | 358 | |
jakowisp | 0:98cf19bcd828 | 359 | |
jakowisp | 0:98cf19bcd828 | 360 | |
jakowisp | 0:98cf19bcd828 | 361 | |
jakowisp | 0:98cf19bcd828 | 362 | |
jakowisp | 0:98cf19bcd828 | 363 | uint16_t USBHostPTP::Operation(uint16_t opcode, uint8_t nparams, uint32_t *params){ |
jakowisp | 0:98cf19bcd828 | 364 | OperFlags flags = {0,0,0,0,0,0}; |
jakowisp | 0:98cf19bcd828 | 365 | flags.opParams = nparams; |
jakowisp | 0:98cf19bcd828 | 366 | |
jakowisp | 0:98cf19bcd828 | 367 | return Transaction(opcode,&flags,params); |
jakowisp | 0:98cf19bcd828 | 368 | } |
jakowisp | 0:98cf19bcd828 | 369 | |
jakowisp | 0:98cf19bcd828 | 370 | uint16_t USBHostPTP::OpenSession(void) { |
jakowisp | 0:98cf19bcd828 | 371 | OperFlags flags = {1,0,0,0,0,0}; |
jakowisp | 0:98cf19bcd828 | 372 | |
jakowisp | 0:98cf19bcd828 | 373 | return Transaction(PTP_OC_OpenSession,&flags,&sessionID); |
jakowisp | 0:98cf19bcd828 | 374 | } |
jakowisp | 0:98cf19bcd828 | 375 | |
jakowisp | 0:98cf19bcd828 | 376 | uint16_t USBHostPTP::CloseSession(void) { |
jakowisp | 0:98cf19bcd828 | 377 | OperFlags flags = {1,0,0,0,0,0}; |
jakowisp | 0:98cf19bcd828 | 378 | |
jakowisp | 0:98cf19bcd828 | 379 | return Transaction(PTP_OC_CloseSession,&flags,&sessionID); |
jakowisp | 0:98cf19bcd828 | 380 | } |
jakowisp | 0:98cf19bcd828 | 381 | |
jakowisp | 0:98cf19bcd828 | 382 | uint16_t USBHostPTP::GetDeviceInfo(void) |
jakowisp | 0:98cf19bcd828 | 383 | { |
jakowisp | 0:98cf19bcd828 | 384 | OperFlags flags = { 0, 0, 0, 1, 1, 0 }; |
jakowisp | 0:98cf19bcd828 | 385 | return Transaction(PTP_OC_GetDeviceInfo, &flags,NULL,(void*)&USBHostPTP::ParseDeviceInfoDataBlock); |
jakowisp | 0:98cf19bcd828 | 386 | } |
jakowisp | 0:98cf19bcd828 | 387 | |
jakowisp | 0:98cf19bcd828 | 388 | |
jakowisp | 0:98cf19bcd828 | 389 | uint16_t USBHostPTP::PowerDown() |
jakowisp | 0:98cf19bcd828 | 390 | { |
jakowisp | 0:98cf19bcd828 | 391 | OperFlags flags = { 0, 0, 0, 0, 0, 0 }; |
jakowisp | 0:98cf19bcd828 | 392 | return Transaction(PTP_OC_PowerDown, &flags); |
jakowisp | 0:98cf19bcd828 | 393 | } |
jakowisp | 0:98cf19bcd828 | 394 | |
jakowisp | 0:98cf19bcd828 | 395 | uint16_t USBHostPTP::SelfTest(uint16_t type) |
jakowisp | 0:98cf19bcd828 | 396 | { |
jakowisp | 0:98cf19bcd828 | 397 | OperFlags flags = { 1, 0, 0, 0, 0, 0 }; |
jakowisp | 0:98cf19bcd828 | 398 | uint32_t params[1]; |
jakowisp | 0:98cf19bcd828 | 399 | params[0] = type; |
jakowisp | 0:98cf19bcd828 | 400 | |
jakowisp | 0:98cf19bcd828 | 401 | return Transaction(PTP_OC_SelfTest, &flags, params); |
jakowisp | 0:98cf19bcd828 | 402 | } |
jakowisp | 0:98cf19bcd828 | 403 | |
jakowisp | 0:98cf19bcd828 | 404 | uint16_t USBHostPTP::GetObjectHandles(uint32_t storage_id, uint16_t format, uint16_t assoc, void *parser) |
jakowisp | 0:98cf19bcd828 | 405 | { |
jakowisp | 0:98cf19bcd828 | 406 | OperFlags flags = { 3, 0, 0, 1, 1, 0 }; |
jakowisp | 0:98cf19bcd828 | 407 | uint32_t params[3]; |
jakowisp | 0:98cf19bcd828 | 408 | |
jakowisp | 0:98cf19bcd828 | 409 | params[0] = storage_id; |
jakowisp | 0:98cf19bcd828 | 410 | params[1] = (uint32_t)format; |
jakowisp | 0:98cf19bcd828 | 411 | params[2] = (uint32_t)assoc; |
jakowisp | 0:98cf19bcd828 | 412 | |
jakowisp | 0:98cf19bcd828 | 413 | return Transaction(PTP_OC_GetObjectHandles, &flags, params, parser); |
jakowisp | 0:98cf19bcd828 | 414 | } |
jakowisp | 0:98cf19bcd828 | 415 | |
jakowisp | 0:98cf19bcd828 | 416 | uint16_t USBHostPTP::GetNumObjects(uint32_t *retval, uint32_t storage_id, uint16_t format, uint32_t assoc) |
jakowisp | 0:98cf19bcd828 | 417 | { |
jakowisp | 0:98cf19bcd828 | 418 | uint16_t ptp_error = PIMAReturnCodeGeneralError; |
jakowisp | 0:98cf19bcd828 | 419 | OperFlags flags = { 3, 1, 0, 0, 0, 0 }; |
jakowisp | 0:98cf19bcd828 | 420 | uint32_t params[3]; |
jakowisp | 0:98cf19bcd828 | 421 | |
jakowisp | 0:98cf19bcd828 | 422 | params[0] = storage_id; |
jakowisp | 0:98cf19bcd828 | 423 | params[1] = (uint32_t)format; |
jakowisp | 0:98cf19bcd828 | 424 | params[2] = (uint32_t)assoc; |
jakowisp | 0:98cf19bcd828 | 425 | |
jakowisp | 0:98cf19bcd828 | 426 | if ( (ptp_error = Transaction(PTP_OC_GetNumObjects, &flags, params)) == PIMAReturnCodeOK) |
jakowisp | 0:98cf19bcd828 | 427 | *retval = responseContainer.param[0]; |
jakowisp | 0:98cf19bcd828 | 428 | |
jakowisp | 0:98cf19bcd828 | 429 | return ptp_error; |
jakowisp | 0:98cf19bcd828 | 430 | } |
jakowisp | 0:98cf19bcd828 | 431 | |
jakowisp | 0:98cf19bcd828 | 432 | uint16_t USBHostPTP::GetObjectInfo(uint32_t handle) |
jakowisp | 0:98cf19bcd828 | 433 | { |
jakowisp | 0:98cf19bcd828 | 434 | OperFlags flags = { 1, 0, 0, 1, 1, 0 }; |
jakowisp | 0:98cf19bcd828 | 435 | uint32_t params[1]; |
jakowisp | 0:98cf19bcd828 | 436 | params[0] = handle; |
jakowisp | 0:98cf19bcd828 | 437 | |
jakowisp | 0:98cf19bcd828 | 438 | //Clear any previous data, incase a Reponse packet is returned instead of a data packet |
jakowisp | 0:98cf19bcd828 | 439 | memset((uint8_t *)&objectInfo,0,0x34); |
jakowisp | 0:98cf19bcd828 | 440 | |
jakowisp | 0:98cf19bcd828 | 441 | return Transaction(PTP_OC_GetObjectInfo, &flags, params, (void*)&USBHostPTP::ParseObjectInfoDataBlock); |
jakowisp | 0:98cf19bcd828 | 442 | } |
jakowisp | 0:98cf19bcd828 | 443 | |
jakowisp | 0:98cf19bcd828 | 444 | uint16_t USBHostPTP::GetThumb(uint32_t handle, void *parser) |
jakowisp | 0:98cf19bcd828 | 445 | { |
jakowisp | 0:98cf19bcd828 | 446 | OperFlags flags = { 1, 0, 0, 1, 1, 0 }; |
jakowisp | 0:98cf19bcd828 | 447 | uint32_t params[1]; |
jakowisp | 0:98cf19bcd828 | 448 | |
jakowisp | 0:98cf19bcd828 | 449 | params[0] = handle; |
jakowisp | 0:98cf19bcd828 | 450 | |
jakowisp | 0:98cf19bcd828 | 451 | return Transaction(PTP_OC_GetThumb, &flags, params, parser); |
jakowisp | 0:98cf19bcd828 | 452 | } |
jakowisp | 0:98cf19bcd828 | 453 | |
jakowisp | 0:98cf19bcd828 | 454 | |
jakowisp | 0:98cf19bcd828 | 455 | uint16_t USBHostPTP::GetObject(uint32_t handle, void *parser) |
jakowisp | 0:98cf19bcd828 | 456 | { |
jakowisp | 0:98cf19bcd828 | 457 | OperFlags flags = { 1, 0, 0, 1, 1, 0 }; |
jakowisp | 0:98cf19bcd828 | 458 | uint32_t params[1]; |
jakowisp | 0:98cf19bcd828 | 459 | |
jakowisp | 0:98cf19bcd828 | 460 | params[0] = handle; |
jakowisp | 0:98cf19bcd828 | 461 | |
jakowisp | 0:98cf19bcd828 | 462 | return Transaction(PTP_OC_GetObject, &flags, params, parser); |
jakowisp | 0:98cf19bcd828 | 463 | } |
jakowisp | 0:98cf19bcd828 | 464 | |
jakowisp | 0:98cf19bcd828 | 465 | uint16_t USBHostPTP::GetStorageIDs(void *parser) |
jakowisp | 0:98cf19bcd828 | 466 | { |
jakowisp | 0:98cf19bcd828 | 467 | OperFlags flags = { 0, 0, 0, 1, 1, 0 }; |
jakowisp | 0:98cf19bcd828 | 468 | return Transaction(PTP_OC_GetStorageIDs, &flags, NULL, parser); |
jakowisp | 0:98cf19bcd828 | 469 | } |
jakowisp | 0:98cf19bcd828 | 470 | |
jakowisp | 0:98cf19bcd828 | 471 | uint16_t USBHostPTP::GetStorageInfo(uint32_t storage_id, void *parser) |
jakowisp | 0:98cf19bcd828 | 472 | { |
jakowisp | 0:98cf19bcd828 | 473 | OperFlags flags = { 1, 0, 0, 1, 1, 0 }; |
jakowisp | 0:98cf19bcd828 | 474 | |
jakowisp | 0:98cf19bcd828 | 475 | uint32_t params[1]; |
jakowisp | 0:98cf19bcd828 | 476 | params[0] = storage_id; |
jakowisp | 0:98cf19bcd828 | 477 | |
jakowisp | 0:98cf19bcd828 | 478 | return Transaction(PTP_OC_GetStorageInfo, &flags, params, parser); |
jakowisp | 0:98cf19bcd828 | 479 | } |
jakowisp | 0:98cf19bcd828 | 480 | |
jakowisp | 0:98cf19bcd828 | 481 | uint16_t USBHostPTP::CopyObject(uint32_t handle, uint32_t storage_id, uint32_t parent, uint32_t *new_handle) |
jakowisp | 0:98cf19bcd828 | 482 | { |
jakowisp | 0:98cf19bcd828 | 483 | uint16_t ptp_error = PIMAReturnCodeGeneralError; |
jakowisp | 0:98cf19bcd828 | 484 | OperFlags flags = { 3, 1, 0, 0, 0, 0 }; |
jakowisp | 0:98cf19bcd828 | 485 | uint32_t params[3]; |
jakowisp | 0:98cf19bcd828 | 486 | |
jakowisp | 0:98cf19bcd828 | 487 | params[0] = handle; |
jakowisp | 0:98cf19bcd828 | 488 | params[1] = storage_id; |
jakowisp | 0:98cf19bcd828 | 489 | params[2] = parent; |
jakowisp | 0:98cf19bcd828 | 490 | |
jakowisp | 0:98cf19bcd828 | 491 | if ( (ptp_error = Transaction(PTP_OC_CopyObject, &flags, params)) == PIMAReturnCodeOK) |
jakowisp | 0:98cf19bcd828 | 492 | *new_handle = responseContainer.param[0]; |
jakowisp | 0:98cf19bcd828 | 493 | |
jakowisp | 0:98cf19bcd828 | 494 | return ptp_error; |
jakowisp | 0:98cf19bcd828 | 495 | } |
jakowisp | 0:98cf19bcd828 | 496 | |
jakowisp | 0:98cf19bcd828 | 497 | |
jakowisp | 0:98cf19bcd828 | 498 | uint16_t USBHostPTP::DeleteObject(uint32_t handle, uint16_t format) |
jakowisp | 0:98cf19bcd828 | 499 | { |
jakowisp | 0:98cf19bcd828 | 500 | OperFlags flags = { 2, 0, 0, 0, 0, 0 }; |
jakowisp | 0:98cf19bcd828 | 501 | uint32_t params[2]; |
jakowisp | 0:98cf19bcd828 | 502 | |
jakowisp | 0:98cf19bcd828 | 503 | params[0] = handle; |
jakowisp | 0:98cf19bcd828 | 504 | params[1] = (uint32_t)format; |
jakowisp | 0:98cf19bcd828 | 505 | |
jakowisp | 0:98cf19bcd828 | 506 | return Transaction(PTP_OC_DeleteObject, &flags, params); |
jakowisp | 0:98cf19bcd828 | 507 | } |
jakowisp | 0:98cf19bcd828 | 508 | |
jakowisp | 0:98cf19bcd828 | 509 | |
jakowisp | 0:98cf19bcd828 | 510 | uint16_t USBHostPTP::SetObjectProtection(uint32_t handle, uint16_t attrib) |
jakowisp | 0:98cf19bcd828 | 511 | { |
jakowisp | 0:98cf19bcd828 | 512 | OperFlags flags = { 2, 0, 0, 0, 0, 0 }; |
jakowisp | 0:98cf19bcd828 | 513 | uint32_t params[2]; |
jakowisp | 0:98cf19bcd828 | 514 | |
jakowisp | 0:98cf19bcd828 | 515 | params[0] = handle; |
jakowisp | 0:98cf19bcd828 | 516 | params[1] = (uint32_t)attrib; |
jakowisp | 0:98cf19bcd828 | 517 | |
jakowisp | 0:98cf19bcd828 | 518 | return Transaction(PTP_OC_SetObjectProtection, &flags, params); |
jakowisp | 0:98cf19bcd828 | 519 | } |
jakowisp | 0:98cf19bcd828 | 520 | |
jakowisp | 0:98cf19bcd828 | 521 | |
jakowisp | 0:98cf19bcd828 | 522 | uint16_t USBHostPTP::MoveObject(uint32_t handle, uint32_t storage_id, uint32_t parent) |
jakowisp | 0:98cf19bcd828 | 523 | { |
jakowisp | 0:98cf19bcd828 | 524 | OperFlags flags = { 3, 0, 0, 0, 0, 0 }; |
jakowisp | 0:98cf19bcd828 | 525 | uint32_t params[3]; |
jakowisp | 0:98cf19bcd828 | 526 | |
jakowisp | 0:98cf19bcd828 | 527 | params[0] = handle; |
jakowisp | 0:98cf19bcd828 | 528 | params[1] = storage_id; |
jakowisp | 0:98cf19bcd828 | 529 | params[2] = parent; |
jakowisp | 0:98cf19bcd828 | 530 | |
jakowisp | 0:98cf19bcd828 | 531 | return Transaction(PTP_OC_MoveObject, &flags, params); |
jakowisp | 0:98cf19bcd828 | 532 | } |
jakowisp | 0:98cf19bcd828 | 533 | |
jakowisp | 0:98cf19bcd828 | 534 | |
jakowisp | 0:98cf19bcd828 | 535 | uint16_t USBHostPTP::GetDevicePropDesc(const uint16_t pcode, void *parser) |
jakowisp | 0:98cf19bcd828 | 536 | { |
jakowisp | 0:98cf19bcd828 | 537 | OperFlags flags = { 1, 0, 0, 1, 1, 0 }; |
jakowisp | 0:98cf19bcd828 | 538 | uint32_t params[1]; |
jakowisp | 0:98cf19bcd828 | 539 | |
jakowisp | 0:98cf19bcd828 | 540 | params[0] = (uint32_t)pcode; |
jakowisp | 0:98cf19bcd828 | 541 | |
jakowisp | 0:98cf19bcd828 | 542 | if(IsPropertySupported(pcode)==false) |
jakowisp | 0:98cf19bcd828 | 543 | return PIMAReturnCodeDevicePropertyNotSupported; |
jakowisp | 0:98cf19bcd828 | 544 | |
jakowisp | 0:98cf19bcd828 | 545 | return Transaction(PTP_OC_GetDevicePropDesc, &flags, params, parser); |
jakowisp | 0:98cf19bcd828 | 546 | } |
jakowisp | 0:98cf19bcd828 | 547 | |
jakowisp | 0:98cf19bcd828 | 548 | |
jakowisp | 0:98cf19bcd828 | 549 | uint16_t USBHostPTP::GetDevicePropValue(const uint16_t pcode, void *parser) |
jakowisp | 0:98cf19bcd828 | 550 | { |
jakowisp | 0:98cf19bcd828 | 551 | OperFlags flags = { 1, 0, 0, 1, 1, 0 }; |
jakowisp | 0:98cf19bcd828 | 552 | uint32_t params[1]; |
jakowisp | 0:98cf19bcd828 | 553 | |
jakowisp | 0:98cf19bcd828 | 554 | params[0] = (uint32_t)pcode; |
jakowisp | 0:98cf19bcd828 | 555 | if(IsPropertySupported(pcode)==false) |
jakowisp | 0:98cf19bcd828 | 556 | return PIMAReturnCodeDevicePropertyNotSupported; |
jakowisp | 0:98cf19bcd828 | 557 | |
jakowisp | 0:98cf19bcd828 | 558 | return Transaction(PTP_OC_GetDevicePropValue, &flags, params, parser); |
jakowisp | 0:98cf19bcd828 | 559 | } |
jakowisp | 0:98cf19bcd828 | 560 | |
jakowisp | 0:98cf19bcd828 | 561 | |
jakowisp | 0:98cf19bcd828 | 562 | uint16_t USBHostPTP::SetDevicePropValue(uint16_t pcode, uint32_t val) |
jakowisp | 0:98cf19bcd828 | 563 | { |
jakowisp | 0:98cf19bcd828 | 564 | OperFlags flags = { 1, 0, 1, 1, 3, 4 }; |
jakowisp | 0:98cf19bcd828 | 565 | uint32_t params[1]; |
jakowisp | 0:98cf19bcd828 | 566 | uint32_t value; |
jakowisp | 0:98cf19bcd828 | 567 | |
jakowisp | 0:98cf19bcd828 | 568 | params[0] = (uint32_t)pcode; |
jakowisp | 0:98cf19bcd828 | 569 | value = val; |
jakowisp | 0:98cf19bcd828 | 570 | |
jakowisp | 0:98cf19bcd828 | 571 | if(IsPropertySupported(pcode)==false) |
jakowisp | 0:98cf19bcd828 | 572 | return PIMAReturnCodeDevicePropertyNotSupported; |
jakowisp | 0:98cf19bcd828 | 573 | |
jakowisp | 0:98cf19bcd828 | 574 | return Transaction(PTP_OC_SetDevicePropValue, &flags, params, (void*)&value); |
jakowisp | 0:98cf19bcd828 | 575 | } |
jakowisp | 0:98cf19bcd828 | 576 | |
jakowisp | 0:98cf19bcd828 | 577 | |
jakowisp | 0:98cf19bcd828 | 578 | uint16_t USBHostPTP::ResetDevicePropValue(const uint16_t pcode) |
jakowisp | 0:98cf19bcd828 | 579 | { |
jakowisp | 0:98cf19bcd828 | 580 | OperFlags flags = { 1, 0, 0, 0 }; |
jakowisp | 0:98cf19bcd828 | 581 | uint32_t params[1]; |
jakowisp | 0:98cf19bcd828 | 582 | |
jakowisp | 0:98cf19bcd828 | 583 | params[0] = (uint32_t)pcode; |
jakowisp | 0:98cf19bcd828 | 584 | |
jakowisp | 0:98cf19bcd828 | 585 | if(IsPropertySupported(pcode)==false) |
jakowisp | 0:98cf19bcd828 | 586 | return PIMAReturnCodeDevicePropertyNotSupported; |
jakowisp | 0:98cf19bcd828 | 587 | |
jakowisp | 0:98cf19bcd828 | 588 | return Transaction(PTP_OC_ResetDevicePropValue, &flags, params); |
jakowisp | 0:98cf19bcd828 | 589 | } |
jakowisp | 0:98cf19bcd828 | 590 | |
jakowisp | 0:98cf19bcd828 | 591 | |
jakowisp | 0:98cf19bcd828 | 592 | uint16_t USBHostPTP::FormatStore(uint32_t storage_id, uint32_t fsformat) |
jakowisp | 0:98cf19bcd828 | 593 | { |
jakowisp | 0:98cf19bcd828 | 594 | OperFlags flags = { 2, 0, 0, 0, 0, 0 }; |
jakowisp | 0:98cf19bcd828 | 595 | |
jakowisp | 0:98cf19bcd828 | 596 | uint32_t params[2]; |
jakowisp | 0:98cf19bcd828 | 597 | params[0] = storage_id; |
jakowisp | 0:98cf19bcd828 | 598 | params[1] = fsformat; |
jakowisp | 0:98cf19bcd828 | 599 | |
jakowisp | 0:98cf19bcd828 | 600 | return Transaction(PTP_OC_FormatStore, &flags, params); |
jakowisp | 0:98cf19bcd828 | 601 | } |
jakowisp | 0:98cf19bcd828 | 602 | |
jakowisp | 0:98cf19bcd828 | 603 | uint16_t USBHostPTP::InitiateCapture(uint32_t storage_id, uint16_t format) |
jakowisp | 0:98cf19bcd828 | 604 | { |
jakowisp | 0:98cf19bcd828 | 605 | uint16_t ptp_error = PIMAReturnCodeGeneralError; |
jakowisp | 0:98cf19bcd828 | 606 | OperFlags flags = { 2, 0, 0, 0, 0, 0 }; |
jakowisp | 0:98cf19bcd828 | 607 | uint32_t params[2]; |
jakowisp | 0:98cf19bcd828 | 608 | |
jakowisp | 0:98cf19bcd828 | 609 | params[0] = storage_id; |
jakowisp | 0:98cf19bcd828 | 610 | params[1] = (uint32_t)format; |
jakowisp | 0:98cf19bcd828 | 611 | |
jakowisp | 0:98cf19bcd828 | 612 | if ( (ptp_error = Transaction(PTP_OC_InitiateCapture, &flags, params)) == PIMAReturnCodeOK){ |
jakowisp | 0:98cf19bcd828 | 613 | } |
jakowisp | 0:98cf19bcd828 | 614 | |
jakowisp | 0:98cf19bcd828 | 615 | return ptp_error; |
jakowisp | 0:98cf19bcd828 | 616 | } |
jakowisp | 0:98cf19bcd828 | 617 | |
jakowisp | 0:98cf19bcd828 | 618 | uint16_t USBHostPTP::InitiateOpenCapture(uint32_t storage_id, uint16_t format) |
jakowisp | 0:98cf19bcd828 | 619 | { |
jakowisp | 0:98cf19bcd828 | 620 | uint16_t ptp_error = PIMAReturnCodeGeneralError; |
jakowisp | 0:98cf19bcd828 | 621 | OperFlags flags = { 2, 0, 0, 0, 0, 0 }; |
jakowisp | 0:98cf19bcd828 | 622 | uint32_t params[2]; |
jakowisp | 0:98cf19bcd828 | 623 | |
jakowisp | 0:98cf19bcd828 | 624 | params[0] = storage_id; |
jakowisp | 0:98cf19bcd828 | 625 | params[1] = (uint32_t)format; |
jakowisp | 0:98cf19bcd828 | 626 | |
jakowisp | 0:98cf19bcd828 | 627 | if ( (ptp_error = Transaction(PTP_OC_InitiateOpenCapture, &flags, params)) == PIMAReturnCodeOK){ |
jakowisp | 0:98cf19bcd828 | 628 | } |
jakowisp | 0:98cf19bcd828 | 629 | |
jakowisp | 0:98cf19bcd828 | 630 | return ptp_error; |
jakowisp | 0:98cf19bcd828 | 631 | } |
jakowisp | 0:98cf19bcd828 | 632 | |
jakowisp | 0:98cf19bcd828 | 633 | uint16_t USBHostPTP::TerminateOpenCapture(uint32_t trans_id) |
jakowisp | 0:98cf19bcd828 | 634 | { |
jakowisp | 0:98cf19bcd828 | 635 | OperFlags flags = { 1, 0, 0, 0, 0, 0 }; |
jakowisp | 0:98cf19bcd828 | 636 | uint32_t params[1]; |
jakowisp | 0:98cf19bcd828 | 637 | |
jakowisp | 0:98cf19bcd828 | 638 | params[0] = trans_id; |
jakowisp | 0:98cf19bcd828 | 639 | |
jakowisp | 0:98cf19bcd828 | 640 | return Transaction(PTP_OC_TerminateOpenCapture, &flags, params); |
jakowisp | 0:98cf19bcd828 | 641 | } |
jakowisp | 0:98cf19bcd828 | 642 | |
jakowisp | 0:98cf19bcd828 | 643 | |
jakowisp | 0:98cf19bcd828 | 644 | |
jakowisp | 0:98cf19bcd828 | 645 | void USBHostPTP::ParseDeviceInfoDataBlock(void *ptp,uint8_t *buffer,uint16_t length){ |
jakowisp | 0:98cf19bcd828 | 646 | uint8_t *currentPtr; |
jakowisp | 0:98cf19bcd828 | 647 | USBHostPTP *dev=(USBHostPTP *)ptp; |
jakowisp | 0:98cf19bcd828 | 648 | |
jakowisp | 0:98cf19bcd828 | 649 | currentPtr=buffer; |
jakowisp | 0:98cf19bcd828 | 650 | dev->deviceInfo.standardVersion=*((uint16_t *)currentPtr); |
jakowisp | 0:98cf19bcd828 | 651 | currentPtr+=2; |
jakowisp | 0:98cf19bcd828 | 652 | dev->deviceInfo.vendorExtensionID=*((uint32_t *)currentPtr); |
jakowisp | 0:98cf19bcd828 | 653 | currentPtr+=4; |
jakowisp | 0:98cf19bcd828 | 654 | dev->deviceInfo.vendorExtensionVersion=*((uint16_t *)currentPtr); |
jakowisp | 0:98cf19bcd828 | 655 | currentPtr+=2; |
jakowisp | 0:98cf19bcd828 | 656 | |
jakowisp | 0:98cf19bcd828 | 657 | currentPtr+=dev->deviceInfo.vendorExtensionDesc.FillString(currentPtr); |
jakowisp | 0:98cf19bcd828 | 658 | |
jakowisp | 0:98cf19bcd828 | 659 | dev->deviceInfo.functionMode=*((uint16_t *)currentPtr); |
jakowisp | 0:98cf19bcd828 | 660 | currentPtr+=2; |
jakowisp | 0:98cf19bcd828 | 661 | |
jakowisp | 0:98cf19bcd828 | 662 | currentPtr+=dev->deviceInfo.operationsSupported.FillArray(currentPtr); |
jakowisp | 0:98cf19bcd828 | 663 | currentPtr+=dev->deviceInfo.eventsSupported.FillArray(currentPtr); |
jakowisp | 0:98cf19bcd828 | 664 | currentPtr+=dev->deviceInfo.devicePropertiesSupported.FillArray(currentPtr); |
jakowisp | 0:98cf19bcd828 | 665 | currentPtr+=dev->deviceInfo.captureFormats.FillArray(currentPtr); |
jakowisp | 0:98cf19bcd828 | 666 | currentPtr+=dev->deviceInfo.imageFormats.FillArray(currentPtr); |
jakowisp | 0:98cf19bcd828 | 667 | |
jakowisp | 0:98cf19bcd828 | 668 | currentPtr+=dev->deviceInfo.manufacturer.FillString(currentPtr); |
jakowisp | 0:98cf19bcd828 | 669 | currentPtr+=dev->deviceInfo.model.FillString(currentPtr); |
jakowisp | 0:98cf19bcd828 | 670 | currentPtr+=dev->deviceInfo.deviceVersion.FillString(currentPtr); |
jakowisp | 0:98cf19bcd828 | 671 | currentPtr+=dev->deviceInfo.serialNumber.FillString(currentPtr); |
jakowisp | 0:98cf19bcd828 | 672 | |
jakowisp | 0:98cf19bcd828 | 673 | } |
jakowisp | 0:98cf19bcd828 | 674 | |
jakowisp | 0:98cf19bcd828 | 675 | void USBHostPTP::ParseObjectInfoDataBlock(void *ptp,uint8_t *buffer,uint16_t length){ |
jakowisp | 0:98cf19bcd828 | 676 | uint8_t *ptr,*structptr; |
jakowisp | 0:98cf19bcd828 | 677 | USBHostPTP *obj=(USBHostPTP *)ptp; |
jakowisp | 0:98cf19bcd828 | 678 | |
jakowisp | 0:98cf19bcd828 | 679 | structptr=(uint8_t *) &(obj->objectInfo); |
jakowisp | 0:98cf19bcd828 | 680 | ptr=buffer; |
jakowisp | 0:98cf19bcd828 | 681 | for(int i=0;i<0x34;i++) |
jakowisp | 0:98cf19bcd828 | 682 | structptr[i]=ptr[i]; |
jakowisp | 0:98cf19bcd828 | 683 | ptr+=0x34; |
jakowisp | 0:98cf19bcd828 | 684 | ptr+=obj->objectInfo.filename.FillString(ptr); |
jakowisp | 0:98cf19bcd828 | 685 | ptr+=obj->objectInfo.captureDate.FillString(ptr); |
jakowisp | 0:98cf19bcd828 | 686 | ptr+=obj->objectInfo.modificationDate.FillString(ptr); |
jakowisp | 0:98cf19bcd828 | 687 | ptr+=obj->objectInfo.keywords.FillString(ptr); |
jakowisp | 0:98cf19bcd828 | 688 | #ifdef USDBPTPDEBUG |
jakowisp | 0:98cf19bcd828 | 689 | obj->DumpObjectInfo(); |
jakowisp | 0:98cf19bcd828 | 690 | #endif |
jakowisp | 0:98cf19bcd828 | 691 | } |
jakowisp | 0:98cf19bcd828 | 692 | |
jakowisp | 0:98cf19bcd828 | 693 | |
jakowisp | 0:98cf19bcd828 | 694 | bool USBHostPTP::IsCommandSupported(uint16_t opcode){ |
jakowisp | 0:98cf19bcd828 | 695 | bool res=false; |
jakowisp | 0:98cf19bcd828 | 696 | |
jakowisp | 0:98cf19bcd828 | 697 | if(opcode==PTP_OC_OpenSession || opcode==PTP_OC_GetDeviceInfo) |
jakowisp | 0:98cf19bcd828 | 698 | res=true; |
jakowisp | 0:98cf19bcd828 | 699 | else |
jakowisp | 0:98cf19bcd828 | 700 | res = CheckValueInArray(&deviceInfo.operationsSupported,opcode); |
jakowisp | 0:98cf19bcd828 | 701 | return res; |
jakowisp | 0:98cf19bcd828 | 702 | } |
jakowisp | 0:98cf19bcd828 | 703 | |
jakowisp | 0:98cf19bcd828 | 704 | bool USBHostPTP::IsPropertySupported(uint16_t code){ |
jakowisp | 0:98cf19bcd828 | 705 | |
jakowisp | 0:98cf19bcd828 | 706 | return CheckValueInArray(&deviceInfo.devicePropertiesSupported, code); |
jakowisp | 0:98cf19bcd828 | 707 | |
jakowisp | 0:98cf19bcd828 | 708 | } |
jakowisp | 0:98cf19bcd828 | 709 | |
jakowisp | 0:98cf19bcd828 | 710 | bool USBHostPTP::CheckValueInArray(PIMAArray *array, uint16_t code) { |
jakowisp | 0:98cf19bcd828 | 711 | bool res=false; |
jakowisp | 0:98cf19bcd828 | 712 | for(int i=0; i<array->numberOfElements;i++) |
jakowisp | 0:98cf19bcd828 | 713 | if(code == array->codes[i]) |
jakowisp | 0:98cf19bcd828 | 714 | res=true; |
jakowisp | 0:98cf19bcd828 | 715 | return res; |
jakowisp | 0:98cf19bcd828 | 716 | } |
jakowisp | 0:98cf19bcd828 | 717 | |
jakowisp | 0:98cf19bcd828 | 718 | |
jakowisp | 0:98cf19bcd828 | 719 | void USBHostPTP::DumpBuffer(uint8_t *buffer,uint32_t length){ |
jakowisp | 0:98cf19bcd828 | 720 | for(int i=0;i<length;i++) { |
jakowisp | 0:98cf19bcd828 | 721 | printf("%02x ",buffer[i]); |
jakowisp | 0:98cf19bcd828 | 722 | if(i % 16 == 15 ) |
jakowisp | 0:98cf19bcd828 | 723 | printf("\r\n"); |
jakowisp | 0:98cf19bcd828 | 724 | } |
jakowisp | 0:98cf19bcd828 | 725 | printf("\r\n"); |
jakowisp | 0:98cf19bcd828 | 726 | } |
jakowisp | 0:98cf19bcd828 | 727 | |
jakowisp | 0:98cf19bcd828 | 728 | |
jakowisp | 0:98cf19bcd828 | 729 | void USBHostPTP::DumpDeviceInfo(){ |
jakowisp | 0:98cf19bcd828 | 730 | int i; |
jakowisp | 0:98cf19bcd828 | 731 | |
jakowisp | 0:98cf19bcd828 | 732 | printf("PIMA standard version: %x\r\n",deviceInfo.standardVersion); |
jakowisp | 0:98cf19bcd828 | 733 | printf("Vendor Extension ID: %x\r\n",deviceInfo.vendorExtensionID); |
jakowisp | 0:98cf19bcd828 | 734 | printf("Vendor Extension Version: %x\r\n",deviceInfo.vendorExtensionVersion); |
jakowisp | 0:98cf19bcd828 | 735 | printf("Vendor Extension Description: \r\n"); |
jakowisp | 0:98cf19bcd828 | 736 | printf("%s\r\n",(deviceInfo.vendorExtensionDesc.getString())); |
jakowisp | 0:98cf19bcd828 | 737 | printf("Functional Mode: %x\r\n",deviceInfo.functionMode); |
jakowisp | 0:98cf19bcd828 | 738 | printf("Supported Operations: \r\n"); |
jakowisp | 0:98cf19bcd828 | 739 | for(i=0;i<deviceInfo.operationsSupported.numberOfElements;i++) { |
jakowisp | 0:98cf19bcd828 | 740 | printf("0x%04x\r\n",deviceInfo.operationsSupported.codes[i]); |
jakowisp | 0:98cf19bcd828 | 741 | } |
jakowisp | 0:98cf19bcd828 | 742 | printf("Supported Events: \r\n"); |
jakowisp | 0:98cf19bcd828 | 743 | for(i=0;i<deviceInfo.eventsSupported.numberOfElements;i++) { |
jakowisp | 0:98cf19bcd828 | 744 | printf("0x%04x\r\n",deviceInfo.eventsSupported.codes[i]); |
jakowisp | 0:98cf19bcd828 | 745 | } |
jakowisp | 0:98cf19bcd828 | 746 | printf("Supported Device Properties: \r\n"); |
jakowisp | 0:98cf19bcd828 | 747 | for(i=0;i<deviceInfo.devicePropertiesSupported.numberOfElements;i++) { |
jakowisp | 0:98cf19bcd828 | 748 | printf("0x%04x\r\n",deviceInfo.devicePropertiesSupported.codes[i]); |
jakowisp | 0:98cf19bcd828 | 749 | } |
jakowisp | 0:98cf19bcd828 | 750 | printf("Supported Capture Formats: \r\n"); |
jakowisp | 0:98cf19bcd828 | 751 | for(i=0;i<deviceInfo.captureFormats.numberOfElements;i++) { |
jakowisp | 0:98cf19bcd828 | 752 | printf("0x%04x\r\n",deviceInfo.captureFormats.codes[i]); |
jakowisp | 0:98cf19bcd828 | 753 | } |
jakowisp | 0:98cf19bcd828 | 754 | printf("Supported Image Formats: \r\n"); |
jakowisp | 0:98cf19bcd828 | 755 | for(i=0;i<deviceInfo.imageFormats.numberOfElements;i++) { |
jakowisp | 0:98cf19bcd828 | 756 | printf("0x%04x\r\n",deviceInfo.imageFormats.codes[i]); |
jakowisp | 0:98cf19bcd828 | 757 | } |
jakowisp | 0:98cf19bcd828 | 758 | |
jakowisp | 0:98cf19bcd828 | 759 | printf("Manufacturer: \r\n"); |
jakowisp | 0:98cf19bcd828 | 760 | printf("%s\r\n",deviceInfo.manufacturer.getString()); |
jakowisp | 0:98cf19bcd828 | 761 | printf("Model: \r\n"); |
jakowisp | 0:98cf19bcd828 | 762 | printf("%s\r\n",deviceInfo.model.getString()); |
jakowisp | 0:98cf19bcd828 | 763 | printf("Device Version: \r\n"); |
jakowisp | 0:98cf19bcd828 | 764 | printf("%s\r\n",deviceInfo.deviceVersion.getString()); |
jakowisp | 0:98cf19bcd828 | 765 | printf("Serial Number: \r\n"); |
jakowisp | 0:98cf19bcd828 | 766 | printf("%s\r\n",deviceInfo.serialNumber.getString()); |
jakowisp | 0:98cf19bcd828 | 767 | |
jakowisp | 0:98cf19bcd828 | 768 | } |
jakowisp | 0:98cf19bcd828 | 769 | |
jakowisp | 0:98cf19bcd828 | 770 | void USBHostPTP::DumpObjectInfo(){ |
jakowisp | 0:98cf19bcd828 | 771 | |
jakowisp | 0:98cf19bcd828 | 772 | |
jakowisp | 0:98cf19bcd828 | 773 | printf("-----------------------ObjectInfo--------------\r\n"); |
jakowisp | 0:98cf19bcd828 | 774 | printf("Storage ID: %08x\r\n",objectInfo.storageID); |
jakowisp | 0:98cf19bcd828 | 775 | printf("Object Format: %04x\r\n",objectInfo.objectFormat); |
jakowisp | 0:98cf19bcd828 | 776 | printf("Protection Status: %04x\r\n",objectInfo.protectionStatus); |
jakowisp | 0:98cf19bcd828 | 777 | printf("Compressed Size: %ld\r\n",objectInfo.objectCompressSize); |
jakowisp | 0:98cf19bcd828 | 778 | printf("Thumbnail format: %04x\r\n",objectInfo.thumbFormat); |
jakowisp | 0:98cf19bcd828 | 779 | printf("Thumbnail Compressed size: %04x\r\n",objectInfo.thumbCompressedSize); |
jakowisp | 0:98cf19bcd828 | 780 | printf("Thumbnail Width %ld\r\n",objectInfo.thumbPixWidth); |
jakowisp | 0:98cf19bcd828 | 781 | printf("Thumbnail Height: %ld\r\n",objectInfo.thumbPixHeight); |
jakowisp | 0:98cf19bcd828 | 782 | printf("Image Width: %ld\r\n",objectInfo.imagePixWidth); |
jakowisp | 0:98cf19bcd828 | 783 | printf("Image Height: %ld\r\n",objectInfo.imagePixHeight); |
jakowisp | 0:98cf19bcd828 | 784 | printf("Image BitDepth: %ld\r\n",objectInfo.imageBitDepth); |
jakowisp | 0:98cf19bcd828 | 785 | printf("Parent Object: %04x\r\n",objectInfo.parentObject); |
jakowisp | 0:98cf19bcd828 | 786 | printf("Assosiaction Type: %02x\r\n",objectInfo.associationType); |
jakowisp | 0:98cf19bcd828 | 787 | printf("Assosiaction Description: %04x\r\n",objectInfo.associationDesc); |
jakowisp | 0:98cf19bcd828 | 788 | printf("Sequence Number: %ld\r\n",objectInfo.sequenceNumber); |
jakowisp | 0:98cf19bcd828 | 789 | |
jakowisp | 0:98cf19bcd828 | 790 | printf("Filename: \r\n"); |
jakowisp | 0:98cf19bcd828 | 791 | printf("%s\r\n",objectInfo.filename.getString()); |
jakowisp | 0:98cf19bcd828 | 792 | printf("Capture Date: \r\n"); |
jakowisp | 0:98cf19bcd828 | 793 | printf("%s\r\n",objectInfo.captureDate.getString()); |
jakowisp | 0:98cf19bcd828 | 794 | printf("Modification Date: \r\n"); |
jakowisp | 0:98cf19bcd828 | 795 | printf("%s\r\n",objectInfo.modificationDate.getString()); |
jakowisp | 0:98cf19bcd828 | 796 | printf("Keywords: \r\n"); |
jakowisp | 0:98cf19bcd828 | 797 | printf("%s\r\n",objectInfo.keywords.getString()); |
jakowisp | 0:98cf19bcd828 | 798 | } |
jakowisp | 0:98cf19bcd828 | 799 | |
jakowisp | 0:98cf19bcd828 | 800 | |
jakowisp | 0:98cf19bcd828 | 801 | |
jakowisp | 0:98cf19bcd828 | 802 | #endif |
jakowisp | 0:98cf19bcd828 | 803 |