Lines Matching refs:params
87 PTPParams *params;
111 static int init_ptp_usb (PTPParams* params, PTP_USB* ptp_usb, struct usb_device* dev);
203 // Do not free() the fields (ptp_usb, params)! These are used elsewhere.
750 libusb_glue_debug (PTPParams *params, const char *format, ...)
755 if (params->debug_func!=NULL)
756 params->debug_func (params->data, format, args);
767 libusb_glue_error (PTPParams *params, const char *format, ...)
772 if (params->error_func!=NULL)
773 params->error_func (params->data, format, args);
1031 memory_getfunc(PTPParams* params, void* private,
1047 memory_putfunc(PTPParams* params, void* private,
1121 ptp_usb_sendreq (PTPParams* params, PTPContainer* req)
1131 (void) ptp_render_opcode (params, req->Code, sizeof(txt), txt);
1140 usbreq.payload.params.param1=htod32(req->Param1);
1141 usbreq.payload.params.param2=htod32(req->Param2);
1142 usbreq.payload.params.param3=htod32(req->Param3);
1143 usbreq.payload.params.param4=htod32(req->Param4);
1144 usbreq.payload.params.param5=htod32(req->Param5);
1151 params->data,
1159 libusb_glue_error (params,
1169 ptp_usb_senddata (PTPParams* params, PTPContainer* ptp,
1188 ((PTP_USB*)params->data)->current_transfer_complete = 0;
1189 ((PTP_USB*)params->data)->current_transfer_total = size+PTP_USB_BULK_HDR_LEN;
1191 if (params->split_header_data) {
1200 ret = handler->getfunc(params, handler->priv, datawlen, usbdata.payload.data, &gotlen);
1208 ret = ptp_write_func(wlen, &memhandler, params->data, &written);
1218 ret = ptp_write_func (bytes_left_to_transfer, handler, params->data, &written);
1232 static uint16_t ptp_usb_getpacket(PTPParams *params,
1240 if (params->response_packet_size > 0) {
1242 memcpy(packet, params->response_packet, params->response_packet_size);
1243 *rlen = params->response_packet_size;
1244 free(params->response_packet);
1245 params->response_packet = NULL;
1246 params->response_packet_size = 0;
1251 ret = ptp_read_func(PTP_USB_BULK_HS_MAX_PACKET_LEN_READ, &memhandler, params->data, rlen, 0);
1261 ptp_usb_getdata (PTPParams* params, PTPContainer* ptp, PTPDataHandler *handler)
1266 PTP_USB *ptp_usb = (PTP_USB *) params->data;
1275 ret = ptp_usb_getpacket(params, &usbdata, &rlen);
1286 libusb_glue_debug (params, "ptp2/ptp_usb_getdata: detected a broken "
1300 libusb_glue_debug (params, "ptp2/ptp_usb_getdata: detected a broken "
1311 params, handler->priv, rlen - PTP_USB_BULK_HDR_LEN, usbdata.payload.data,
1324 params->data,
1352 params->response_packet = malloc(surplen);
1353 memcpy(params->response_packet,
1355 params->response_packet_size = surplen;
1359 libusb_glue_debug (params, "ptp2/ptp_usb_getdata: read %d bytes "
1375 params->split_header_data = 1;
1380 params, handler->priv, rlen - PTP_USB_BULK_HDR_LEN, usbdata.payload.data,
1398 } else if (len+PTP_USB_BULK_HDR_LEN == PTP_USB_BULK_HS_MAX_PACKET_LEN_READ && params->split_header_data == 0) {
1418 params->data, &rlen, 1);
1428 ptp_usb_getresp (PTPParams* params, PTPContainer* resp)
1433 PTP_USB *ptp_usb = (PTP_USB *)(params->data);
1440 ret = ptp_usb_getpacket(params, &usbresp, &rlen);
1447 libusb_glue_debug (params, "ptp_usb_getresp: detected short response "
1450 ret = ptp_usb_getpacket(params, &usbresp, &rlen);
1466 /* libusb_glue_error (params,
1473 resp->SessionID=params->session_id;
1476 if (resp->Transaction_ID != params->transaction_id-1) {
1477 libusb_glue_debug (params, "ptp_usb_getresp: detected a broken "
1481 resp->Transaction_ID = params->transaction_id-1;
1484 resp->Param1=dtoh32(usbresp.payload.params.param1);
1485 resp->Param2=dtoh32(usbresp.payload.params.param2);
1486 resp->Param3=dtoh32(usbresp.payload.params.param3);
1487 resp->Param4=dtoh32(usbresp.payload.params.param4);
1488 resp->Param5=dtoh32(usbresp.payload.params.param5);
1499 ptp_usb_event (PTPParams* params, PTPContainer* event, int wait)
1505 PTP_USB *ptp_usb = (PTP_USB *)(params->data);
1509 if ((params==NULL) || (event==NULL))
1530 libusb_glue_error (params,
1536 libusb_glue_error (params,
1543 event->SessionID=params->session_id;
1552 ptp_usb_event_check (PTPParams* params, PTPContainer* event) {
1554 return ptp_usb_event (params, event, PTP_EVENT_CHECK_FAST);
1558 ptp_usb_event_wait (PTPParams* params, PTPContainer* event) {
1560 return ptp_usb_event (params, event, PTP_EVENT_CHECK);
1564 ptp_usb_control_cancel_request (PTPParams *params, uint32_t transactionid) {
1565 PTP_USB *ptp_usb = (PTP_USB *)(params->data);
1579 static int init_ptp_usb (PTPParams* params, PTP_USB* ptp_usb, struct usb_device* dev)
1583 params->sendreq_func=ptp_usb_sendreq;
1584 params->senddata_func=ptp_usb_senddata;
1585 params->getresp_func=ptp_usb_getresp;
1586 params->getdata_func=ptp_usb_getdata;
1587 params->cancelreq_func=ptp_usb_control_cancel_request;
1588 params->data=ptp_usb;
1589 params->transaction_id=0;
1594 params->byteorder = PTP_DL_LE;
1775 * This function assigns params and usbinfo given a raw device
1782 PTPParams *params,
1846 if (init_ptp_usb(params, ptp_usb, libusb_device) < 0) {
1855 if ((ret = ptp_opensession(params, 1)) == PTP_ERROR_IO) {
1859 if(init_ptp_usb(params, ptp_usb, libusb_device) <0) {
1865 ret = ptp_opensession(params, 1);
1871 params->transaction_id += 10;
1872 ret = ptp_opensession(params, 1);
1890 void close_device (PTP_USB *ptp_usb, PTPParams *params)
1892 if (ptp_closesession(params)!=PTP_RC_OK)