Permalink
Browse files

Implemented first attempt to a minimal CHDK PTP interface.

N.B.: This implementation (of both CHDK and ptpcam) is incompatible with the
original(/initial) CHDK PTP patch.
  • Loading branch information...
1 parent c2bea02 commit da2ad4c3c02c8b1de09c9b2e5135406c9430462c @mweerden committed Apr 5, 2010
Showing with 320 additions and 380 deletions.
  1. +1 −1 Makefile
  2. +1 −1 buildconf.inc
  3. +12 −49 core/gui.c
  4. +0 −2 core/gui_draw.c
  5. +34 −1 core/luascript.c
  6. +114 −169 core/ptp.c
  7. +17 −12 core/ptp.h
  8. +3 −1 include/camera.h
  9. +4 −0 include/core.h
  10. +2 −4 include/lolevel.h
  11. +7 −4 include/platform.h
  12. +4 −4 makefile.inc
  13. +11 −0 platform/generic/wrappers.c
  14. +12 −7 platform/ixus870_sd880/lib.c
  15. +49 −105 tools/ptpcam/ptp.c
  16. +22 −14 tools/ptpcam/ptp.h
  17. +27 −6 tools/ptpcam/ptpcam.c
View
@@ -44,7 +44,7 @@ endif
ifdef NEED_ENCODED_DISKBOOT
@echo dance \-\> DISKBOOT.BIN ver $(NEED_ENCODED_DISKBOOT)
$(ENCODE_DISKBOOT) $(topdir)bin/main.bin $(topdir)bin/DISKBOOT.BIN $(NEED_ENCODED_DISKBOOT)
-# rm $(topdir)bin/main.bin
+ rm $(topdir)bin/main.bin
else
mv $(topdir)bin/main.bin $(topdir)bin/DISKBOOT.BIN
endif
View
@@ -17,7 +17,7 @@ OPT_LUA_STRLIB=1
#OPT_LUA_CALL_NATIVE=1
#OPT_MD_DEBUG=1
# needs proper fi2.inc in platform/ !!! see http://chdk.setepontos.com/index.php/topic,2995.0.html
-OPT_FI2=1
+#OPT_FI2=1
# if enabled, compiler will produce a lot of warnings, maybe not always correct ones, see http://chdk.setepontos.com/index.php/topic,2509.msg32191.html#msg32191
#OPT_WARNINGS=1
# If enabled (and reference binaries are present in /tools), compiler will generate function signatures
View
@@ -2589,69 +2589,32 @@ void gui_draw_debug_vals_osd() {
// long v=get_file_counter();
// sprintf(osd_buf, "1:%03d-%04d ", (v>>18)&0x3FF, (v>>4)&0x3FFF);
// sprintf(osd_buf, "1:%d, %08X ", xxxx, eeee);
-
-// extern long debug_long;
-// sprintf(osd_buf, "8:%08x ", debug_long);
-// draw_txt_string(28, 10, osd_buf, conf.osd_color);
-
-// sprintf(osd_buf, "8:%08x ", *((int *)0xC02200F8));
-// draw_txt_string(28, 10, osd_buf, conf.osd_color);
-//
-// sprintf(osd_buf, "C:%08x ", *((int *)0xC02200FC));
-// draw_txt_string(28, 11, osd_buf, conf.osd_color);
-
-// int zp=lens_get_zoom_point(), fl1=get_focal_length(zp);
-// sprintf(osd_buf, "zp:%8i ", zp);
-// draw_txt_string(28, 10, osd_buf, conf.osd_color);
-//
-// sprintf(osd_buf, "fl:%8i ", fl1);
-// draw_txt_string(28, 11, osd_buf, conf.osd_color);
-
+ /*
extern long physw_status[3];
-// sprintf(osd_buf, "0:%8x ", physw_status[0]);
-// draw_txt_string(28, 10, osd_buf, conf.osd_color);
-//
-// sprintf(osd_buf, "1:%8x ", physw_status[1]);
-// draw_txt_string(28, 11, osd_buf, conf.osd_color);
-//
- sprintf(osd_buf, "2:%8x ", physw_status[2]);
- draw_txt_string(28, 9, osd_buf, conf.osd_color);
- short x;
- sprintf(osd_buf, "zs:%8x ", zoom_status);
+ sprintf(osd_buf, "1:%8x ", physw_status[0]);
draw_txt_string(28, 10, osd_buf, conf.osd_color);
- get_property_case(PROPCASE_DIGITAL_ZOOM_STATE, &x, sizeof(x));
- sprintf(osd_buf, "dzs:%8x ", x);
+
+ sprintf(osd_buf, "2:%8x ", physw_status[1]);
draw_txt_string(28, 11, osd_buf, conf.osd_color);
- get_property_case(PROPCASE_DIGITAL_ZOOM_POSITION, &x, sizeof(x));
- sprintf(osd_buf, "dzp:%8x ", x);
+
+ sprintf(osd_buf, "3:%8x ", physw_status[2]);
draw_txt_string(28, 12, osd_buf, conf.osd_color);
// sprintf(osd_buf, "4:%8x ", vid_get_viewport_fb_d());
-
-// sprintf(osd_buf, "j:%8x ", Get_JogDial());
-// draw_txt_string(28, 9, osd_buf, conf.osd_color);
-
-// extern long movie_status;
-// sprintf(osd_buf, "m:%8x ", movie_status);
-// draw_txt_string(28, 9, osd_buf, conf.osd_color);
-
-// extern long playrec_mode;
-// sprintf(osd_buf, "m:%8x ", playrec_mode);
-// draw_txt_string(28, 9, osd_buf, conf.osd_color);
-
- //sprintf(osd_buf, "u:%8x ", get_usb_power(1));
- //draw_txt_string(28, 9, osd_buf, conf.osd_color);
+ */
+ sprintf(osd_buf, "u:%8x ", get_usb_power(1));
+ draw_txt_string(28, 9, osd_buf, conf.osd_color);
sprintf(osd_buf, "1:%8x ", (void*) (*(int*)conf.mem_view_addr_init));
- //draw_txt_string(28, 10, osd_buf, conf.osd_color);
+ draw_txt_string(28, 10, osd_buf, conf.osd_color);
extern volatile long focus_busy;
sprintf(osd_buf, "f:%8x ", focus_busy);
- //draw_txt_string(28, 11, osd_buf, conf.osd_color);
+ draw_txt_string(28, 11, osd_buf, conf.osd_color);
extern volatile long zoom_busy;
sprintf(osd_buf, "z:%8x ", zoom_busy);
- //draw_txt_string(28, 12, osd_buf, conf.osd_color);
+ draw_txt_string(28, 12, osd_buf, conf.osd_color);
// some cameras missing zoom_status
#if 0
View
@@ -389,9 +389,7 @@ void draw_clear() {
//-------------------------------------------------------------------
void draw_restore() {
-// if (gui_get_mode()!=GUI_MODE_NONE) vid_turn_on_updates();
vid_bitmap_refresh();
-// if (gui_get_mode()!=GUI_MODE_NONE) vid_turn_off_updates();
}
//-------------------------------------------------------------------
View
@@ -536,9 +536,15 @@ static int luaCB_exit_alt( lua_State* L )
return 0;
}
+// optional parameter is 0 for soft shutdown (default) or 1 for hard/immediate
static int luaCB_shut_down( lua_State* L )
{
- camera_shutdown_in_a_second();
+ if ( luaL_optnumber(L,1,0) == 1 )
+ {
+ shutdown();
+ } else {
+ camera_shutdown_in_a_second();
+ }
return 0;
}
@@ -1155,6 +1161,30 @@ static int luaCB_set_record( lua_State* L )
return 0;
}
+// reboot camera (with FI2 if supplied as arg)
+static int luaCB_reboot( lua_State* L )
+{
+ const char *fn = luaL_optstring(L,1,NULL);
+
+ reboot(fn);
+
+ return 0;
+}
+
+// switch mode (0 = playback, 1 = record)
+// XXX currently only for when USB is connected
+static int luaCB_switch_mode( lua_State* L )
+{
+ int mode = luaL_checknumber(L,1);
+
+ if ( mode != 0 && mode != 1 )
+ {
+ return 0;
+ }
+
+ return switch_mode(mode);
+}
+
/*
pack the lua args into a buffer to pass to the native code calling functions
currently only handles strings/numbers
@@ -1434,6 +1464,9 @@ void register_lua_funcs( lua_State* L )
FUNC(set_record);
+ FUNC(reboot);
+ FUNC(switch_mode);
+
#ifdef OPT_LUA_CALL_NATIVE
FUNC(call_event_proc);
FUNC(call_func_ptr);
Oops, something went wrong.

0 comments on commit da2ad4c

Please sign in to comment.