@@ -146,6 +146,15 @@ int bind_get_object_info(struct BindReq *bind, struct PtpRuntime *r) {
146
146
return len ;
147
147
}
148
148
149
+ int bind_send_object_info (struct BindReq * bind , struct PtpRuntime * r ) {
150
+ struct PtpObjectInfo oi ;
151
+ strcpy (oi .filename , "FOO_BAR.JPG" );
152
+ int x = ptp_send_object_info (r , 0 , 0 , & oi );
153
+ if (x ) return bind -> out (bind , "{\"error\": %d}" , x );
154
+ int len = bind -> out (bind , "{\"error\": %d}" , x );
155
+ return len ;
156
+ }
157
+
149
158
int bind_custom (struct BindReq * bind , struct PtpRuntime * r ) {
150
159
struct PtpCommand cmd ;
151
160
cmd .code = bind -> params [0 ];
@@ -257,6 +266,15 @@ int bind_set_property(struct BindReq *bind, struct PtpRuntime *r) {
257
266
return bind -> out (bind , "{\"error\": %d}" , x );
258
267
}
259
268
269
+ int bind_get_property (struct BindReq * bind , struct PtpRuntime * r ) {
270
+ int x = ptp_get_prop_value (r , bind -> params [0 ]);
271
+ if (x ) {
272
+ return bind -> out (bind , "{\"error\": %d}" , x );
273
+ } else {
274
+ return bind -> out (bind , "{\"error\": %d, \"value\": %u}" , x , ptp_parse_prop_value (r ));
275
+ }
276
+ }
277
+
260
278
int bind_get_events (struct BindReq * bind , struct PtpRuntime * r ) {
261
279
int dev = ptp_device_type (r );
262
280
@@ -541,9 +559,11 @@ struct RouteMap {
541
559
{"ptp_eos_set_event_mode" , bind_eos_set_event_mode },
542
560
543
561
{"ptp_cancel_af" , bind_cancel_af },
544
-
562
+ // Flip DSLR mirror up - or enter liveview
545
563
{"ptp_mirror_up" , bind_mirror_up },
564
+ // Flip mirror down - or disable liveview
546
565
{"ptp_mirror_down" , bind_mirror_down },
566
+ // Focus lens in/out
547
567
{"ptp_drive_lens" , bind_drive_lens },
548
568
{"ptp_get_liveview_frame" , bind_get_liveview_frame },
549
569
{"ptp_get_liveview_type" , bind_get_liveview_type },
@@ -552,17 +572,21 @@ struct RouteMap {
552
572
{"ptp_ml_init_bmp_lv" , bind_ml_init_bmp_lv },
553
573
{"ptp_init_liveview" , bind_liveview_init },
554
574
{"ptp_deinit_liveview" , bind_liveview_deinit },
575
+ // Try and detect manufacturer/type of device connected
555
576
{"ptp_get_device_type" , bind_get_device_type },
577
+ // Get a generic list of events
556
578
{"ptp_get_events" , bind_get_events },
557
579
{"ptp_get_all_props" , bind_get_all_props },
558
580
{"ptp_set_property" , bind_set_property },
581
+ {"ptp_get_property" , bind_get_property },
559
582
{"ptp_get_enums" , bind_get_enums },
560
583
{"ptp_get_status" , bind_get_status },
561
584
{"ptp_get_return_code" , bind_get_return_code },
562
585
{"ptp_get_storage_ids" , bind_get_storage_ids },
563
586
{"ptp_get_storage_info" , bind_get_storage_info },
564
587
{"ptp_get_object_handles" , bind_get_object_handles },
565
588
{"ptp_get_object_info" , bind_get_object_info },
589
+ {"ptp_send_object_info" , bind_send_object_info },
566
590
{"ptp_get_thumbnail" , bind_get_thumbnail },
567
591
{"ptp_get_partial_object" , bind_get_partial_object },
568
592
{"ptp_download_file" , bind_download_file },
@@ -576,5 +600,5 @@ int bind_run_req(struct PtpRuntime *r, struct BindReq *bind) {
576
600
}
577
601
}
578
602
579
- return - 1 ;
603
+ return 1 ;
580
604
}
0 commit comments