Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - aprofiti

#26
Had a look again at ML initialization routine for missing calls and now is looking much better :)



I'm using this sequence inside ml_big_init_task() of platform/5DC.111/init.c:

  _mem_init();
  bmp_vram_idle_ptr = (int)malloc(360*240);
  _find_ml_card();
  _load_fonts();
  call("DisablePowerSave");
  _ml_cbr_init();
  menu_init();
  debug_init();
  call_init_funcs(0);
  msleep(200); // leave some time for property handlers to run
  config_load();
  debug_init_stuff();


Modules loading still crashes without enabling anything (only available arkanoid, file_man, bench, pic_view from compilation), but this time error message is different.

Overlays doesn't works (they were working in beta4), same with intervalometer and there are still some problem while rendering text of task list; MLU works, also expo change in play mode.



ETTR as text of config submenu, like with 450D, if I try to change camera freezes but after reboot wasn't appearing anymore (still a lot of empty selection)
#27


Figured out how to use two patches from scrax to have a copy of his previous and post tracked what was the main problem.
Don't know why it's showing only 2 menu tabs.

Assert related to mem.c was solved adding "_mem_init()" before malloc space for "bmp_vram_idle_ptr" and to make loads fonts is necessaries to "call_init_funcs(0)" before "_load_fonts()".

If I try to load all tasks, I get an error related to 5DC.sym I still need to figure out, probably related to module_task.
Unfortunately I'm still unable to make my previous patch to works, even with init.c and gui.c from scrax's work.

Here is the link to the patch (may have unnecessary changes because is a mix of an old patch found in the forum).

Any help is appreciated
#28
Some old notes which can come in handy on horizontal and vertical, plus a spreadsheet of the initial analysis.

Cmos[5] may be responsible of vertical crop area position; expected full-res up to 7 FPS compared to 5 FPS 5d2, due to faster clock speed.

Haven't tried yet to increase vertical resolution and reduce to minimum timing, because I'm currently experimenting in other areas.
I expect to see some interesting results from you, reeddercity. Good luck! :)
#29
@scrax I tried again starting from vxworks-dm-spy branch (haven't tried your patch yet, but looks like it isn't complete, how should I use it?), but I get stuck with a 5 seconds blue led on and 5 seconds off, which I need to track down.

Anyone know what it means? Trash button doesn't works and  firmware version in Canon l's Menu wasn't replaced by ML

Will try to post a diff later if I can go over; I tried to not put all inside dummy.c and find what was possible, but some stubs looks like are not present in the Rom disassembly compared to 40D/450D.

Didn't change init.c a lot, just lunch firmware as a pointer because I wasn't able to find why compiler is not able to find reference inside Stubs S...
Noticed it is much different from the one used in 40D and 450D. Does it need to be updated or is better to leave as is because more specific to 5dc?

To make them compile, I had to add dm-spy-extra and exmem into makefile as extra objs

EDIT: ML initialization hangs when calling hijack_gui_main_task(), when malloc memory for bmp_vram_idle_ptr or ml_big_init_task(); Menu and other buttons get partially overridden by hijacking function

diff --git a/platform/40D.111/Makefile.setup.default b/platform/40D.111/Makefile.setup.default
--- a/platform/40D.111/Makefile.setup.default
+++ b/platform/40D.111/Makefile.setup.default
@@ -13,4 +13,5 @@
ML_SRC_EXTRA_OBJS = \
init.o \
dummy.o \
- dm-spy.o
+ dm-spy.o \
+ dm-spy-extra.o
diff --git a/platform/40D.111/stubs.S b/platform/40D.111/stubs.S
--- a/platform/40D.111/stubs.S
+++ b/platform/40D.111/stubs.S
@@ -221,6 +221,9 @@
NSTUB(0xFFD56470,  TryPostStageEvent)
NSTUB(0xFFD564FC,  TryPostStageEvent_end)                   // PendStageEvent

+//TODO:
+NSTUB(0xFFD6A1C8,  current_task)                        // 0x22E00
+
NSTUB(0xFFD6A1C8,  get_current_task)                        // 0x22E00
NSTUB(0xFFD69F8C,  get_task_info)
NSTUB(0xFFD6B8B0,  get_active_task_list)
diff --git a/platform/Makefile.platform.map b/platform/Makefile.platform.map
--- a/platform/Makefile.platform.map
+++ b/platform/Makefile.platform.map
@@ -14,10 +14,10 @@
700D.114 \
EOSM.202 \
1100D.105 \
+ 5DC.111 \
6D.116

PLATFORM_MAP_UNMAINTAINED = \
- 5DC.111 \
100D.100 \

platform_map = $(filter $(1).%, $(PLATFORM_MAP))
diff --git a/platform/unmaintained/5DC.111/Makefile.setup.default b/platform/unmaintained/5DC.111/Makefile.setup.default
--- a/platform/unmaintained/5DC.111/Makefile.setup.default
+++ b/platform/unmaintained/5DC.111/Makefile.setup.default
@@ -10,16 +10,18 @@
fps-engio.o \
audio-ak.o \
movtweaks.o \
- exmem.o \
liveview.o \
bootflags.o \
lv-img-engio.o \
hdr.o \
+ exmem.o \
+

ML_SRC_EXTRA_OBJS = \
init.o \
dummy.o \
dm-spy.o \
- tp-spy.o
+ dm-spy-extra.o \
+ # tp-spy.o

CFLAG_USER += -Wno-unused-variable
diff --git a/platform/unmaintained/5DC.111/consts.h b/platform/unmaintained/5DC.111/consts.h
--- a/platform/unmaintained/5DC.111/consts.h
+++ b/platform/unmaintained/5DC.111/consts.h
@@ -2,8 +2,12 @@
  *  5Dc 1.1.1 consts
  */

+extern int _dummy_variable;
+
#define CANON_SHUTTER_RATING 100000

+#define CARD_DRIVE "A:/"
+
#define CARD_LED_ADDRESS 0xC02200A0 // http://magiclantern.wikia.com/wiki/Led_addresses
#define LEDBLUE     *(int*)0xC02200F0
#define LEDRED      *(int*)0xC02200A0
@@ -14,7 +18,7 @@
#define FORMAT_BTN "[Q]"
#define STR_LOC 11

-#define YUV422_LV_BUFFER_1 0x10b63e8
+#define YUV422_LV_BUFFER_1 0x10b63e8
#define YUV422_LV_BUFFER_2 0x10b63ec
#define YUV422_LV_BUFFER_3 0x10b63f0
#define YUV422_LV_BUFFER_DISPLAY_ADDR YUV422_LV_BUFFER_1
@@ -39,7 +43,11 @@
#define PLAY_MODE (gui_state == GUISTATE_PLAYMENU && MEM(0x27D8) && !MEM(0x3D50)) // StartPl1App, but not StartPlEraseApp
#define MENU_MODE (gui_state == GUISTATE_PLAYMENU && MEM(0x4C48)) // StartMenuMainHeaderApp

-#define CURRENT_GUI_MODE (gui_state == GUISTATE_PLAYMENU ? 1 : 0)
+// TODO:
+//#define CURRENT_GUI_MODE (gui_state == GUISTATE_PLAYMENU ? 1 : 0)
+#define CURRENT_GUI_MODE 1
+#define GUIMODE_PLAY 2
+#define GUISTATE_QR_ZOOM 3

#define NUM_PICSTYLES 9
#define PROP_PICSTYLE_SETTINGS(i) (PROP_PICSTYLE_SETTINGS_STANDARD - 1 + i)
@@ -106,4 +114,3 @@
//~ #define ARROW_MODE_TOGGLE_KEY ""

#define WINSYS_BMP_DIRTY_BIT_NEG 0
-
diff --git a/platform/unmaintained/5DC.111/dummy.c b/platform/unmaintained/5DC.111/dummy.c
--- a/platform/unmaintained/5DC.111/dummy.c
+++ b/platform/unmaintained/5DC.111/dummy.c
@@ -2,6 +2,7 @@
#include "bmp.h"
#include "gui.h"
#include "menu.h"
+#include "timer.h"

// dummy stubs

@@ -14,17 +15,17 @@
//~ void *CreateRecursiveLock(int n){}
void *ReleaseRecursiveLock(void *lock){ return NULL; }
//void bmp_zoom(uint8_t* dst, uint8_t* src, int x0, int y0, int denx, int deny) { return; }
-struct memSuite * shoot_malloc_suite_contig(size_t size) { return 0; }
-struct memSuite *shoot_malloc_suite(size_t size) { return 0; }
+struct memSuite * _shoot_malloc_suite_contig(size_t size) { return 0; }
+struct memSuite * _shoot_malloc_suite(size_t size) { return 0; }
struct memChunk * GetFirstChunkFromSuite(struct memSuite * suite) { return 0; }
-void* GetMemoryAddressOfMemoryChunk(struct memChunk * chunk) { return 0; }
-void shoot_free_suite(struct memSuite * hSuite) { return; }
+//void* GetMemoryAddressOfMemoryChunk(struct memChunk * chunk) { return 0; }
+//void shoot_free_suite(struct memSuite * hSuite) { return; }
struct memChunk * GetNextMemoryChunk(struct memSuite * suite, struct memChunk * chunk) { return 0; }
int audio_meters_are_drawn() { return 0; }
int override_zoom_buttons = 0;
void lcd_release_step(){};
void force_liveview() {};
-int lcd_release_running = 0;
+//int lcd_release_running = 0;
void set_shooting_mode(){};
int get_screen_layout(){ return 0; };
void rec_notify_trigger(){};
@@ -41,9 +42,9 @@
int is_mvr_buffer_almost_full(){ return 0; }
void rec_notify_continuous(){};
void movie_indicators_show(){};
-void display_shooting_info(){};
-void free_space_show_photomode(){};
-void dialog_redraw(){}
+//void display_shooting_info(){};
+//void free_space_show_photomode(){};
+void dialog_redraw(struct dialog * dialog){}
int digic_iso_gain_photo;
int digic_iso_gain_movie;
void MuteOff_0(){}
@@ -77,7 +78,7 @@
void volume_up(){};
void volume_down(){};

-void _EngDrvOut(int addr, int value) { MEM(addr) = value; }
+void _EngDrvOut(uint32_t reg, uint32_t value) { MEM(reg) = value; }
uint32_t shamem_read(uint32_t addr) { return 0; }
void _engio_write() {}

@@ -105,10 +106,12 @@
int get_effective_hdr_iso_for_display(int raw_iso ) { return 1; };
void set_movie_digital_iso_gain(int gain) {};

-int bmp_is_on() { return 1; }
+//int bmp_is_on() { return 1; }

-void* shoot_malloc(size_t size) { return AllocateMemory(size); }
-void shoot_free(void* ptr) { FreeMemory(ptr); }
+//void* shoot_malloc(size_t size) { return AllocateMemory(size); }
+void* _shoot_malloc(size_t size) { return malloc(size); }
+void _shoot_free(void* ptr) { free(ptr); }
+//void shoot_free(void* ptr) { FreeMemory(ptr); }

void display_gain_toggle(){};
//void yuv_resize(){};
@@ -118,3 +121,31 @@
void movie_tweak_menu_init() {};
//int hdr_video_enabled() { return 0; };
int get_digic_iso_gain_movie() { return 0; };
+
+//Altre
+//int sound_recording_enabled() { return 0; }
+//void DeleteMemorySuite(struct memSuite * suite) { }
+int SetTimerAfter(int delay_ms, timerCbr_t timer_cbr, timerCbr_t overrun_cbr, void* priv) { return 0; }
+void CancelDateTimer();
+int64_t FIO_SeekSkipFile( FILE* stream, int64_t position, int whence ) { return 0; }
+//0xFF015E9C
+void SetGUIRequestMode(int mode){}
+void* _srm_malloc(size_t size){ return malloc(size);}
+void _srm_free(void* ptr){free(ptr);}
+int _srm_get_free_space(){return 0;}
+int _srm_get_max_region(){return 0;}
+int _shoot_get_free_space(){return 0;}
+int _shoot_free_suite(){return 0;}
+struct memSuite * _srm_malloc_suite(int num_requested_buffers){}
+void _srm_free_suite(struct memSuite * suite){}
+
+/* per exmec.c */
+struct memSuite * CreateMemorySuite(void* first_chunk_address, size_t first_chunk_size, uint32_t flags) { return 0; }
+struct memChunk * CreateMemoryChunk(void* address, size_t size, uint32_t flags) { return 0; }
+void DeleteMemorySuite(struct memSuite * suite) { }
+int sound_recording_enabled() { return 0; }
+void SRM_AllocateMemoryResourceFor1stJob(void (*callback)(void** dst_ptr, void* raw_buffer, uint32_t raw_buffer_size), void** dst_ptr) { }
+int AddMemoryChunk(struct memSuite * suite, struct memChunk * chunk) { return 0; }
+void CancelDateTimer();
+void SRM_FreeMemoryResourceFor1stJob(void* raw_buffer, int unk1_zero, int unk2_zero) { }
+//int GetSizeOfMaxRegion(int* max_region) { return 0; }
diff --git a/platform/unmaintained/5DC.111/features.h b/platform/unmaintained/5DC.111/features.h
--- a/platform/unmaintained/5DC.111/features.h
+++ b/platform/unmaintained/5DC.111/features.h
@@ -17,7 +17,7 @@
#define FEATURE_HISTOGRAM
#define FEATURE_WAVEFORM
#define FEATURE_VECTORSCOPE
- #define FEATURE_OVERLAYS_IN_PLAYBACK_MODE
+//TODO: fixme #define FEATURE_OVERLAYS_IN_PLAYBACK_MODE
//#define FEATURE_FALSE_COLOR

/** Shoot menu **/
@@ -60,7 +60,7 @@

/** Debug menu **/

- #define FEATURE_SCREENSHOT
+//TODO: Enable later #define FEATURE_SCREENSHOT

#define FEATURE_DONT_CLICK_ME

@@ -72,4 +72,3 @@
     #define FEATURE_SHOW_FREE_MEMORY
//#define FEATURE_SHOW_SHUTTER_COUNT //not working
     #define FEATURE_SHOW_CMOS_TEMPERATURE
-
diff --git a/platform/unmaintained/5DC.111/gui.c b/platform/unmaintained/5DC.111/gui.c
--- a/platform/unmaintained/5DC.111/gui.c
+++ b/platform/unmaintained/5DC.111/gui.c
@@ -16,19 +16,28 @@
#include "dryos.h"

struct semaphore * gui_sem;
+extern void gui_massive_event_loop2( uint32_t, void *, uint32_t );
+extern void unknown_gui_function(uint32_t,uint32_t);
+extern void GUI_ChangeMode(uint32_t);
+extern void other_gui_post_event(uint32_t,uint32_t*,uint32_t);
+extern int bindGUISwitchCBR(int,int,int,int);
+extern void DeleteTask(int);
+extern int QueryTaskByName(char *);
+extern int handle_mlu_toggle(struct event * event);
+//TODO: Adapt to gui.c from 40D - was refactored?

// return 0 if you want to block this event
static int handle_buttons(struct event * event)
{
ASSERT(event->type == 0)
-
+
if (event->type != 0) return 1; // only handle events with type=0 (buttons)
if (handle_common_events_startup(event) == 0) return 0;
extern int ml_started;
if (!ml_started) return 1;

if (handle_common_events_by_feature(event) == 0) return 0;
-   
+
     if (handle_mlu_toggle(event) == 0) return 0;

return 1;
diff --git a/platform/unmaintained/5DC.111/init.c b/platform/unmaintained/5DC.111/init.c
--- a/platform/unmaintained/5DC.111/init.c
+++ b/platform/unmaintained/5DC.111/init.c
@@ -1,4 +1,5 @@
#include "dryos.h"
+#include "dryos-notes.h"
#include "bmp.h"
#include "gui.h"
#include "menu.h"
@@ -8,9 +9,14 @@
/** Specified by the linker */
extern uint32_t _bss_start[], _bss_end[];
extern void create_task_cmd_shell(const char * name);
+void hijack_gui_main_task();
void ml_big_init_task(); // forward declaration
int bmp_vram_idle_ptr;

+void config_parse_file( char * );
+extern uint32_t get_current_task();
+extern void ioGlobalStdSet(int,int);
+
void start_debug_mode() {
int file;
char filename[20] = "A:/DEBUG.LOG"; // default name
@@ -18,7 +24,9 @@
time_t t;
struct tm tm;

- file = (int) FIO_OpenFile(filename, O_CREAT | O_WRONLY , 644);
+// file = (int) FIO_OpenFile(filename, O_CREAT | O_WRONLY , 644);
+file = (int) FIO_OpenFile(filename, O_CREAT | O_WRONLY );
+
if(file > 0) {
// redirect stdout and stderr to our file
ioGlobalStdSet(1, file);
@@ -305,6 +313,7 @@
#endif
}/*}}}*/

+extern int init_code_run();
void copy_and_restart()
{/*{{{*/
//blink(1);
@@ -350,8 +359,11 @@

//cache_fake(0xFF810054, 0xE3A01078, TYPE_ICACHE); // MOV R1, #0x78
//cache_fake(0xFF810058, 0xE2811A01, TYPE_ICACHE); // ADD R1, R1, 0x1004 - enable caches
- firmware_entry();

+ //TODO: fixme
+// firmware_entry();
+ void (*reset)(void) = (void*) ROMBASEADDR;
+ reset();

// unreachable
while(1) {
@@ -450,7 +462,7 @@
  To hijack an EventDispatch of a manager or module, remember:
  - Modules have a StageClass
  - Managers have a TaskClass
-
+
  The structures for these are already defined in state-object.h
  NOTE: you can only hijack one manager or module at a time. Never try to hijack more than one! (could brick camera).
  **/
@@ -596,7 +608,7 @@
snprintf(assert_msg, sizeof(assert_msg),
"ML ASSERT:\n%s\n"
"at %s:%d (%s), task %s\n",
- msg,
+ msg,
file, line, func, get_task_name_from_id(get_current_task())
);
request_crash_log(2);
@@ -625,3 +637,15 @@
}
}/*}}}*/

+
+/* For gui-comon.c */
+int magic_off = 0; // Set to 1 to disable ML
+
+unsigned short int magic_is_off()
+{
+    return magic_off;
+}
+
+void _disable_ml_startup() {
+    magic_off_request = 1;
+}
diff --git a/platform/unmaintained/5DC.111/stubs.S b/platform/unmaintained/5DC.111/stubs.S
--- a/platform/unmaintained/5DC.111/stubs.S
+++ b/platform/unmaintained/5DC.111/stubs.S
@@ -52,8 +52,10 @@
NSTUB(0xFF811060,  aIcuFirmwareVer)
NSTUB(0xFF811078,  aK213)
NSTUB(0xFFB2A56C,  alloc_dma_memory)
+NSTUB(0xFFB2A56C,  _alloc_dma_memory)
NSTUB(0xFF8B6248,  AllocateFileCacheItem)
NSTUB(0xFFB2F664,  AllocateMemory)
+NSTUB(0xFFB2F664,  _AllocateMemory)
NSTUB(0xFFB40474,  armInitExceptionModes)
NSTUB(0xFF811000,  aRomReady)
NSTUB(0xFFB44EC4,  asctime)
@@ -172,8 +174,11 @@
NSTUB(0xFFB41CB0,  fputs)
NSTUB(0xFFB41D38,  fread)
NSTUB(0xFFB4CB14,  free)
+NSTUB(0xFFB4CB14,  _free)
NSTUB(0xFFB2A5B0,  free_dma_memory)
+NSTUB(0xFFB2A5B0,  _free_dma_memory)
NSTUB(0xFFB2F680,  FreeMemory)
+NSTUB(0xFFB2F680,  _FreeMemory)
NSTUB(0xFFB41E3C,  freopen)
NSTUB(0xFFB39988,  frexp)
NSTUB(0xFFB42024,  fscanf)
@@ -195,6 +200,7 @@
NSTUB(0xFFB1A1D0,  GetNameInformation)
NSTUB(0xFFB42AC4,  gets)
NSTUB(0xFFB19564,  GetSelfTaskHandle)
+NSTUB(0xffb2f734 ,GetSizeOfMaxRegion) //TODO: check again
NSTUB(0xFFB1FF74,  GetSystemTime)
NSTUB(0xFFB18430,  give_semaphore)
NSTUB(0xFF812308,  GM_Initialize)
@@ -256,6 +262,7 @@
NSTUB(0xFFB4B400,  logTask)
NSTUB(0xFFB4130C,  longjmp)
NSTUB(0xFFB4CB08,  malloc)
+NSTUB(0xFFB4CB08,  _malloc)
NSTUB(0xFFB4CAF4,  memAddToPool)
//NSTUB( 0xFFB4B774, memalign )
//NSTUB( 0xFFB44664, memcpy )
@@ -626,6 +633,7 @@
NSTUB(0xFFB29CC0,  TryPostStageEvent)
NSTUB(0xFFB29D4C,  TryPostStageEvent_end)

+NSTUB(0xFFB57898,  current_task) //TODO: fixme
NSTUB(0xFFB57898,  get_current_task)
NSTUB(0xFFB58490,  get_task_info)
NSTUB(0xFFB561F0,  get_active_task_list)
@@ -651,5 +659,3 @@
NSTUB(0xFFB4641C,  sub_FFB4641C)
NSTUB(0xFFB46508,  sub_FFB46508)
NSTUB(0xFFB46478,  sub_FFB46478)
-
-
diff --git a/src/bootflags.c b/src/bootflags.c
--- a/src/bootflags.c
+++ b/src/bootflags.c
@@ -120,7 +120,7 @@

// http://www.datarescue.com/laboratory/partition.htm
// http://magiclantern.wikia.com/wiki/Bootdisk
-#if !defined(CONFIG_500D) && !defined(CONFIG_50D) && !defined(CONFIG_5D2) && !defined(CONFIG_40D) && !defined(CONFIG_450D)
+#if !defined(CONFIG_500D) && !defined(CONFIG_50D) && !defined(CONFIG_5D2) && !defined(CONFIG_40D) && !defined(CONFIG_450D) && !defined(CONFIG_5DC)
int
bootflag_write_bootblock( void )
{
@@ -204,17 +204,17 @@
{
#if defined CONFIG_500D
     struct cf_device * const dev = sd_device[1];
-#elif defined(CONFIG_50D) || defined(CONFIG_5D2) || defined(CONFIG_40D) || defined(CONFIG_450D)// not good for 40D, need checking
+#elif defined(CONFIG_50D) || defined(CONFIG_5D2) || defined(CONFIG_40D) || defined(CONFIG_450D) || defined(CONFIG_5DC) // not good for 40D, need checking
     struct cf_device * const dev = cf_device[5];
#endif
-   
+
     uint8_t *block = fio_malloc( 512 );
-   
+
     int i;
     for(i=0; i<512; i++) block[i] = 0xAA;

     dev->read_block( dev, 0, 1, block ); //overwrite our AAAs in our buffer with the MBR partition of the SD card.
-   
+
     // figure out if we are a FAT32 partitioned drive. this spells out FAT32 in chars.
     // FAT16 not supported yet - I don't have a small enough card to test with.
     //if( block[0x52] == 0x46 && block[0x53] == 0x41 && block[0x54] == 0x54 && block[0x55] == 0x33 && block[0x56] == 0x32 )
diff --git a/src/console.c b/src/console.c
--- a/src/console.c
+++ b/src/console.c
@@ -315,6 +315,7 @@

/* some functions from standard I/O */

+#ifndef CONFIG_5DC
int printf(const char* fmt, ...)
{
     /* when called from init_task, 512 bytes are enough to cause stack overflow */
@@ -336,3 +337,4 @@
     console_puts("\n");
     return 0;
}
+#endif
diff --git a/src/debug.c b/src/debug.c
--- a/src/debug.c
+++ b/src/debug.c
@@ -2004,7 +2004,7 @@
     return 1;
}

-#if defined (CONFIG_40D) || defined(CONFIG_450D)
+#if defined (CONFIG_40D) || defined(CONFIG_450D) || defined(CONFIG_5DC)
void _redraw_do() { }
#endif

diff --git a/src/dryos-notes.h b/src/dryos-notes.h
--- a/src/dryos-notes.h
+++ b/src/dryos-notes.h
@@ -54,6 +54,7 @@
extern void audio_level_task(void);
extern void audio_interval_unlock(void*);

+/*
extern FILE *
FIO_OpenFile(
         const char *            name
@@ -63,7 +64,7 @@
int mode
#endif
);
-
+*/
extern ssize_t
FR_SyncReadFile(
         const char *            filename,
diff --git a/src/fio-ml.c b/src/fio-ml.c
--- a/src/fio-ml.c
+++ b/src/fio-ml.c
@@ -353,18 +353,25 @@
FILE* _FIO_OpenFile(const char* filename, unsigned mode );

/* this one returns 0 on error, just like in plain C */
+/*#ifdef CONFIG_VXWORKS
+FILE* FIO_OpenFile(const char* filename, int flags,
+ int mode)
+
+#else*/
FILE* FIO_OpenFile(const char* filename, unsigned mode )
+//#endif
+
{
     char new_filename[FIO_MAX_PATH_LENGTH];
     fixup_filename(new_filename, filename, sizeof(new_filename));
-   
+
     FILE* f = _FIO_OpenFile(new_filename, mode);
-   
+
     if (f != PTR_INVALID)
     {
         return f;
     }
-   
+
     return 0;
}

diff --git a/src/fio-ml.h b/src/fio-ml.h
--- a/src/fio-ml.h
+++ b/src/fio-ml.h
@@ -100,7 +100,19 @@
};

// file IO
+/*
+#ifdef CONFIG_VXWORKS
+extern FILE *
+FIO_OpenFile(
+        const char *            name
+ ,
+ int flags,
+ int mode
+);
+#else*/
extern FILE* FIO_OpenFile( const char* filename, unsigned mode );
+//#endif
+
extern int FIO_ReadFile( FILE* stream, void* ptr, size_t count );
extern int FIO_WriteFile( FILE* stream, const void* ptr, size_t count );
extern void FIO_CloseFile( FILE* stream );
diff --git a/src/mem.c b/src/mem.c
--- a/src/mem.c
+++ b/src/mem.c
@@ -1547,9 +1547,9 @@
             },
             MENU_EOL
         },
-    },
+    },
+#endif
};
-#endif

void mem_menu_init()
{
diff --git a/src/menu.c b/src/menu.c
--- a/src/menu.c
+++ b/src/menu.c
@@ -129,7 +129,7 @@

static int is_customize_selected();

-#if defined (CONFIG_40D)  || defined(CONFIG_450D)
+#if defined (CONFIG_40D)  || defined(CONFIG_450D) || defined(CONFIG_5DC)
void CancelDateTimer() { }
#else
extern void CancelDateTimer();
diff --git a/src/posix.c b/src/posix.c
--- a/src/posix.c
+++ b/src/posix.c
@@ -40,10 +40,12 @@
}

/* warning - not implemented yet */
+#ifndef CONFIG_5DC
int time()
{
     return 0;
}
+#endif

int clock()
{
diff --git a/src/raw.c b/src/raw.c
--- a/src/raw.c
+++ b/src/raw.c
@@ -288,6 +288,15 @@
      -887, 10000,     2129, 10000,    6051, 10000
#endif

+#ifdef CONFIG_5DC // these values are in ufraw-0.22
+    //~{ "Canon EOS 40D", 0, 0x3f60,
+        //~{ 6071,-747,-856,-7653,15365,2441,-2025,2553,7315 } },
+    #define CAM_COLORMATRIX1                       \
+     6071, 10000,     -747, 10000,    -856, 10000, \
+    -7653, 10000,    15365, 10000,    2441, 10000, \
+    -2025, 10000,     2553, 10000,    7315, 10000
+#endif
+
#ifdef CONFIG_40D // these values are in ufraw-0.22
     //~{ "Canon EOS 40D", 0, 0x3f60,
         //~{ 6071,-747,-856,-7653,15365,2441,-2025,2553,7315 } },
@@ -400,6 +409,11 @@
static int dynamic_ranges[] = {1100, 1094, 1060, 1005, 919, 826, 726, 633};
#endif

+#ifdef CONFIG_5DC
+// TODO: FIXME: correct values
+static int dynamic_ranges[] = {1100, 1094, 1060, 1005, 919, 826, 726, 633};
+#endif
+
#ifdef CONFIG_450D
// TODO: FIXME: correct values
static int dynamic_ranges[] = {1100, 1094, 1060, 1005, 919, 826, 726, 633};
diff --git a/src/shoot.c b/src/shoot.c
--- a/src/shoot.c
+++ b/src/shoot.c
@@ -1309,6 +1309,10 @@
void expo_adjust_playback(int dir)
{
#ifdef CONFIG_5DC
+    //TODO: fixme
+    extern void BmpDDev_take_semaphore();
+    extern void BmpDDev_give_semaphore();
+
     static int expo_value = 0;
     if (dir == 0)
     {
diff --git a/src/tasks.c b/src/tasks.c
--- a/src/tasks.c
+++ b/src/tasks.c
@@ -210,6 +210,7 @@
     info->custom_drawing = CUSTOM_DRAW_THIS_MENU;
     
#if defined(CONFIG_VXWORKS)
+/*extern int get_active_task_list(void* arr,int n)

     if (entry->selected)
     {
@@ -251,7 +252,7 @@
             y = 10;
         }
     }
-
+*/
#else // DryOS - https://groups.google.com/forum/#!msg/ml-devel/JstGrNJiuVM/2L1QZpZ7F4YJ

     #ifdef CONFIG_TSKMON
diff --git a/src/tweaks.c b/src/tweaks.c
--- a/src/tweaks.c
+++ b/src/tweaks.c
@@ -1098,8 +1098,8 @@
                     while (!quickzoom_unpressed && PLAY_MODE)
                     {
                         #ifdef CONFIG_5DC
-                        (int32_t)MEM(IMGPLAY_ZOOM_LEVEL_ADDR) = MIN((int32_t)MEM(IMGPLAY_ZOOM_LEVEL_ADDR) + 3, IMGPLAY_ZOOM_LEVEL_MAX);
-                        (int32_t)MEM(IMGPLAY_ZOOM_LEVEL_ADDR + 4) = MIN((int32_t)MEM(IMGPLAY_ZOOM_LEVEL_ADDR + 4) + 3, IMGPLAY_ZOOM_LEVEL_MAX);
+                        MEM(IMGPLAY_ZOOM_LEVEL_ADDR) = MIN((int32_t)MEM(IMGPLAY_ZOOM_LEVEL_ADDR) + 3, IMGPLAY_ZOOM_LEVEL_MAX);
+                        MEM(IMGPLAY_ZOOM_LEVEL_ADDR + 4) = MIN((int32_t)MEM(IMGPLAY_ZOOM_LEVEL_ADDR + 4) + 3, IMGPLAY_ZOOM_LEVEL_MAX);
                         #endif
                         fake_simple_button(BGMT_PRESS_ZOOM_IN);
                         msleep(50);
#30
Forum and Website / Re: what happened?
May 07, 2019, 05:58:00 PM
Would like to ask if there are more tutorials or documentation regarding module development apart the public "hello world".
It would be useful to know more about using CBRs and other modules related things (ex. sharing of procedures between 2 modules).
#31
Camera-specific Development / Re: Canon EOS R / RP
April 27, 2019, 11:50:43 PM
Don't know if it's a valid way to find bump buffer without a ram dump or MMIO logs, but found the "SetDrawWait" reference while looking for 6d2 and 800d stubs.

Pointer inside the function's body appears to match the 200D and 77D dumps. Maybe you can try with EOS R?
#32
Camera-specific Development / Re: Canon EOS R / RP
April 27, 2019, 12:08:24 PM
It probably locked due to firmware signature not corresponding.
I saw you didn't updated it yet in your repo.

You can also replace qprintf messages to print using uart if you prefer to not use qemu
#33
Scripting Corner / Re: Lua Scripting (lua.mo)
April 19, 2019, 07:21:43 PM
It still try to move over the limits, but first it goes back a little bit and then change again in the selected direction...
Also the motor make a different noise than normal
#34
Scripting Corner / Re: Lua Scripting (lua.mo)
April 19, 2019, 07:12:27 PM
Quote from: a1ex on April 19, 2019, 06:59:11 PM
If you enable Follow Focus (without loading the Lua module) and try to move the focus with the joystick, does that work? Similar messages on the console?
Yes similiar messages.



Positive values with left direction (infinity) and negative in the opposite (macro); also 1000 pop off immediatly when limit is reached, but stuck message after some tryes
#35
Scripting Corner / Re: Lua Scripting (lua.mo)
April 19, 2019, 06:53:00 PM
Autofocusing works in the tfirst stage (before pressing AF-ON) and then first second of the second stage, then reach infinity and get stuck


#36
Scripting Corner / Re: Lua Scripting (lua.mo)
April 19, 2019, 06:35:53 PM
Quote from: a1ex on April 19, 2019, 06:11:00 PM
It freezes whenever I turn off the camera (no matter how - from power switch or from card/battery doors). Repeatable. Default settings, no modules loaded.
No problems over here

Quote from: a1ex on April 19, 2019, 06:11:00 PM
That line of code should not execute on 50D; maybe the test contains a typo or something? I did not test that change (it was in the December 23 build, reply #438).
Yes is a typo. Test runs fine if I change the string.
From test logs:

camera = table:
  model = "Canon EOS 50D"
  model_short = "50D"


Quote from: a1ex on April 19, 2019, 06:11:00 PM
This part of the test appeared to work, to some extent, in unified, so... it's a regression.
Don't understand why camera shutdown immediatly during the test.
This appen also with an older unified build (Feb04-18), I don't remember if this was an issue with older build than these ones

Quote from: a1ex on April 19, 2019, 06:11:00 PM
While it's stuck trying to focus over infinity, are there "Lens moving" messages on the console? These are not logged; they are just printed. If yes, can you show me a few values? (a screenshot would be fine)
Yes a lot of them... Even if I manually move the autofocus ring in the opposite direction, some hits and then agin stuck.
Give me a few minutes to take the sceenshoot
#37
Scripting Corner / Re: Lua Scripting (lua.mo)
April 19, 2019, 05:48:24 PM
Quote from: a1ex on April 19, 2019, 03:13:07 PM
BTW, is the 50D able to shut down cleanly with the latest lua_fix build? The 5D2 is not (it locks up with both LEDs turned on).
What do you do exacly? If I use the build normally, it doesn't looks like it need a battery pull.
Camera freezes as described before if I run api_test.lua untouched and need to take battery out to power down camera.

Here are more detailed tests using lua_fix 20-03-19:

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-19 16:55:05
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 88
    apex = 4.
    ms = 63
    value = 0.0625
  aperture = table:
    raw = 32
    apex = 3.
    value = 2.8
    min = table:
      raw = 32
      apex = 3.
      value = 2.8
    max = table:
      raw = 88
      apex = 10.
      value = 32
  iso = table:
    raw = 80
    apex = 6.
    value = 200
  ec = table:
    raw = 0
    value = 0
  flash = true
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 149
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  shoot = function: 0x9f1194
  bulb = function: 0x9f13c8
  reboot = function: 0x9f1168
  burst = function: 0x9f1448
  wait = function: 0x9f00c0
event = table:
  pre_shoot = nil
  post_shoot = nil
  shoot_task = nil
  seconds_clock = nil
  keypress = nil
  custom_picture_taking = nil
  intervalometer = nil
  config_save = nil
console = table:
  show = function: 0x9eea54
  write = function: 0x9eeae8
  hide = function: 0x9eea44
  clear = function: 0x9eea34
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  stop = function: 0x9f15e0
  resume = function: 0x9f1c68
  info = function: 0x9f1974
  start = function: 0x9f15d0
  pause = function: 0x9f1c78
  wait = function: 0x9f2038
lens = table:
  name = "17-50mm"
  focal_length = 17
  focus_distance = 0
  hyperfocal = 5466
  dof_near = 11139225
  dof_far = 1000000
  af = true
  af_mode = 0
  autofocus = function: 0x9f2b1c
  focus = function: 0x9f2ce4
display = table:
  idle = nil
  height = 480
  width = 720
  print = function: 0x9f4990
  load = function: 0x9f3854
  screenshot = function: 0x9f348c
  notify_box = function: 0x9f3624
  draw = function: 0x9f370c
  off = function: 0x9f3560
  on = function: 0x9f3570
  clear = function: 0x9f347c
  line = function: 0x9f44fc
  circle = function: 0x9f3ec8
  pixel = function: 0x9f47c4
  rect = function: 0x9f4198
key = table:
  last = 20
  press = function: 0x9f5168
  wait = function: 0x9f4ea0
menu = table:
  visible = false
  new = function: 0x9f7590
  get = function: 0x9f6934
  block = function: 0x9f56d0
  open = function: 0x9f54e0
  select = function: 0x9f6680
  set = function: 0x9f6754
  close = function: 0x9f54c8
movie = table:
  recording = false
  stop = function: 0x9f30e4
  start = function: 0x9f3178
dryos = table:
  clock = 15
  ms_clock = 15996
  image_prefix = "IMG_"
  config_dir = table:
    exists = true
    create = function: 0x9f88b4
    children = function: 0x9f873c
    files = function: 0x9f8620
    parent = table:
      exists = true
      create = function: 0x9f88b4
      children = function: 0x9f873c
      files = function: 0x9f8620
      parent = table:
        exists = true
        create = function: 0x9f88b4
        children = function: 0x9f873c
        files = function: 0x9f8620
        parent = nil
        path = "A:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0x9f88b4
      children = function: 0x9f873c
      files = function: 0x9f8620
      parent = table:
        exists = true
        create = function: 0x9f88b4
        children = function: 0x9f873c
        files = function: 0x9f8620
        parent = table:
          exists = true
          create = function: 0x9f88b4
          children = function: 0x9f873c
          files = function: 0x9f8620
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/109CANON/"
    file_number = 2411
    folder_number = 109
    free_space = 1168
    image_path = function: 0x9f8a90
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  shooting_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0x9f88b4
      children = function: 0x9f873c
      files = function: 0x9f8620
      parent = table:
        exists = true
        create = function: 0x9f88b4
        children = function: 0x9f873c
        files = function: 0x9f8620
        parent = table:
          exists = true
          create = function: 0x9f88b4
          children = function: 0x9f873c
          files = function: 0x9f8620
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/109CANON/"
    file_number = 2411
    folder_number = 109
    free_space = 1168
    image_path = function: 0x9f8a90
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  cf_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0x9f88b4
      children = function: 0x9f873c
      files = function: 0x9f8620
      parent = table:
        exists = true
        create = function: 0x9f88b4
        children = function: 0x9f873c
        files = function: 0x9f8620
        parent = table:
          exists = true
          create = function: 0x9f88b4
          children = function: 0x9f873c
          files = function: 0x9f8620
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/109CANON/"
    file_number = 2411
    folder_number = 109
    free_space = 1168
    image_path = function: 0x9f8a90
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  sd_card = nil
  date = table:
    sec = 7
    month = 4
    hour = 16
    day = 19
    isdst = false
    min = 55
    wday = 3
    year = 2019
    yday = 1
  remove = function: 0x9f8114
  rename = function: 0x9f8040
  directory = function: 0x9f8180
  call = function: 0x9f7e3c
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: 0x9f94d0
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:45: in function <ML/SCRIPTS/API_TEST.LUA:44>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:44: in function 'globals.print_table'
ML/SCRIPTS/API_TEST.LUA:90: in function 'globals.generic_tests'
ML/SCRIPTS/API_TEST.LUA:1568: in function <ML/SCRIPTS/API_TEST.LUA:1564>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:1564: in function 'globals.api_tests'
ML/SCRIPTS/API_TEST.LUA:1603: in main chunktask = table:
  yield = function: 0x9f9b38
  create = function: 0x9f9cb8
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt

Camera Locks, battery pull required.

Running with test_io() disabled:

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-19 17:02:29
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 88
    apex = 4.
    ms = 63
    value = 0.0625
  aperture = table:
    raw = 32
    apex = 3.
    value = 2.8
    min = table:
      raw = 32
      apex = 3.
      value = 2.8
    max = table:
      raw = 88
      apex = 10.
      value = 32
  iso = table:
    raw = 80
    apex = 6.
    value = 200
  ec = table:
    raw = 0
    value = 0
  flash = true
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 149
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  bulb = function: 0x9f1368
  shoot = function: 0x9f1134
  reboot = function: 0x9f1108
  wait = function: 0x9f0060
  burst = function: 0x9f13e8
event = table:
  pre_shoot = nil
  post_shoot = nil
  shoot_task = nil
  seconds_clock = nil
  keypress = nil
  custom_picture_taking = nil
  intervalometer = nil
  config_save = nil
console = table:
  hide = function: 0x9ee9e4
  show = function: 0x9ee9f4
  clear = function: 0x9ee9d4
  write = function: 0x9eea88
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  pause = function: 0x9f1c18
  info = function: 0x9f1914
  start = function: 0x9f1570
  wait = function: 0x9f1fd8
  resume = function: 0x9f1c08
  stop = function: 0x9f1580
lens = table:
  name = "17-50mm"
  focal_length = 32
  focus_distance = 0
  hyperfocal = 19312
  dof_near = -934934500
  dof_far = 1000000
  af = true
  af_mode = 0
  focus = function: 0x9f2c84
  autofocus = function: 0x9f2abc
display = table:
  idle = nil
  height = 480
  width = 720
  line = function: 0x9f449c
  off = function: 0x9f3500
  circle = function: 0x9f3e68
  on = function: 0x9f3510
  print = function: 0x9f4930
  notify_box = function: 0x9f35c4
  screenshot = function: 0x9f342c
  draw = function: 0x9f36ac
  pixel = function: 0x9f4764
  load = function: 0x9f37f4
  clear = function: 0x9f341c
  rect = function: 0x9f4138
key = table:
  last = 20
  wait = function: 0x9f4e40
  press = function: 0x9f5108
menu = table:
  visible = false
  new = function: 0x9f7530
  close = function: 0x9f5468
  get = function: 0x9f68d4
  select = function: 0x9f6620
  open = function: 0x9f5480
  block = function: 0x9f5670
  set = function: 0x9f66f4
movie = table:
  recording = false
  stop = function: 0x9f3084
  start = function: 0x9f3118
dryos = table:
  clock = 19
  ms_clock = 19920
  image_prefix = "IMG_"
  config_dir = table:
    exists = true
    create = function: 0x9f8854
    children = function: 0x9f86dc
    files = function: 0x9f85c0
    parent = table:
      exists = true
      create = function: 0x9f8854
      children = function: 0x9f86dc
      files = function: 0x9f85c0
      parent = table:
        exists = true
        create = function: 0x9f8854
        children = function: 0x9f86dc
        files = function: 0x9f85c0
        parent = nil
        path = "A:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0x9f8854
      children = function: 0x9f86dc
      files = function: 0x9f85c0
      parent = table:
        exists = true
        create = function: 0x9f8854
        children = function: 0x9f86dc
        files = function: 0x9f85c0
        parent = table:
          exists = true
          create = function: 0x9f8854
          children = function: 0x9f86dc
          files = function: 0x9f85c0
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/109CANON/"
    file_number = 2411
    folder_number = 109
    free_space = 1168
    image_path = function: 0x9f8a30
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  shooting_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0x9f8854
      children = function: 0x9f86dc
      files = function: 0x9f85c0
      parent = table:
        exists = true
        create = function: 0x9f8854
        children = function: 0x9f86dc
        files = function: 0x9f85c0
        parent = table:
          exists = true
          create = function: 0x9f8854
          children = function: 0x9f86dc
          files = function: 0x9f85c0
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/109CANON/"
    file_number = 2411
    folder_number = 109
    free_space = 1168
    image_path = function: 0x9f8a30
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  cf_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0x9f8854
      children = function: 0x9f86dc
      files = function: 0x9f85c0
      parent = table:
        exists = true
        create = function: 0x9f8854
        children = function: 0x9f86dc
        files = function: 0x9f85c0
        parent = table:
          exists = true
          create = function: 0x9f8854
          children = function: 0x9f86dc
          files = function: 0x9f85c0
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/109CANON/"
    file_number = 2411
    folder_number = 109
    free_space = 1168
    image_path = function: 0x9f8a30
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  sd_card = nil
  date = table:
    sec = 30
    year = 2019
    wday = 3
    day = 19
    hour = 17
    isdst = false
    min = 2
    yday = 1
    month = 4
  directory = function: 0x9f8120
  rename = function: 0x9f7fe0
  call = function: 0x9f7ddc
  remove = function: 0x9f80b4
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: 0x9f9470
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:45: in function <ML/SCRIPTS/API_TEST.LUA:44>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:44: in function 'globals.print_table'
ML/SCRIPTS/API_TEST.LUA:90: in function 'globals.generic_tests'
ML/SCRIPTS/API_TEST.LUA:1568: in function <ML/SCRIPTS/API_TEST.LUA:1564>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:1564: in function 'globals.api_tests'
ML/SCRIPTS/API_TEST.LUA:1603: in main chunktask = table:
  create = function: 0x9f9c58
  yield = function: 0x9f9ad8
property = table:
Generic tests completed.

Module tests...
Testing Canon GUI functions...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Pause LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Resume LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Stop LiveView...
Start LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Resume LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Resume LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Canon GUI tests completed.

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Snap simulation test...
Single picture...
A:/DCIM/109CANON/IMG_2412.CR2: 20937882
A:/DCIM/109CANON/IMG_2412.JPG not found.
Two burst pictures...
Ideally, the camera should be in some continuous shooting mode (not checked).
A:/DCIM/109CANON/ABC_2413.CR2: 21029918
A:/DCIM/109CANON/ABC_2413.JPG not found.
A:/DCIM/109CANON/ABC_2414.CR2: 21038890
A:/DCIM/109CANON/ABC_2414.JPG not found.
Bracketed pictures...
A:/DCIM/109CANON/IMG_2415.CR2: 18218930
A:/DCIM/109CANON/IMG_2415.JPG not found.
A:/DCIM/109CANON/IMG_2416.CR2: 20825360
A:/DCIM/109CANON/IMG_2416.JPG not found.
A:/DCIM/109CANON/IMG_2417.CR2: 21973768
A:/DCIM/109CANON/IMG_2417.JPG not found.
Bulb picture...
Elapsed time: 11847
A:/DCIM/109CANON/IMG_2418.CR2: 12013692
A:/DCIM/109CANON/IMG_2418.JPG not found.
Picture taking tests completed.

Testing multitasking...
Only one task allowed to interrupt...
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Multitasking tests completed.

Testing half-shutter...
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
Half-shutter test OK.

Testing module 'lv'...
Starting LiveView...

ML/SCRIPTS/API_TEST.LUA:1246: assertion failed!
stack traceback:
[C]: in function 'globals.assert'
ML/SCRIPTS/API_TEST.LUA:1246: in function 'globals.test_lv'
ML/SCRIPTS/API_TEST.LUA:1578: in function <ML/SCRIPTS/API_TEST.LUA:1564>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:1564: in function 'globals.api_tests'
ML/SCRIPTS/API_TEST.LUA:1603: in main chunk


Starting from test_lens_focus():

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-19 17:15:26
===============================================================================

Module tests...

Testing lens focus functionality...
Autofocus outside LiveView...
Focus distance: 0
Autofocus in LiveView...
Is there something to focus on?
29...28...27...26...Please trigger autofocus (half-shutter / AF-ON / * ).
59...58...57...56...55...54...53...52...51...50...49...48...Autofocus triggered.
Autofocus completed.
Focus distance: 0
Focusing backward...

Here autofocus can't be triggered with Half-Shutter, I used AF-ON.
Script was running in an infinite loop and Lens AF was stuck trying go over infinity

Only test_camera_exposure() and test_movie():

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-19 17:21:42
===============================================================================

Module tests...
Testing exposure settings...
Camera    : Canon EOS 50D (50D) 1.0.9
Lens      : 17-50mm
Shoot mode: 3
Shutter   : �5 (raw 75, 0.192776s, 193ms, apex 2.375)
Aperture  : �2.8 (raw 32, f/2.8, apex 3.)
Av range  : �2.8..�32 (raw 32..88, f/2.8..f/32, apex 3...10.)
ISO       : �1600 (raw 104, 1600, apex 9.)
EC        : 0.0 (raw 0, 0 EV)
Flash EC  : 0.0 (raw 0, 0 EV)
Setting shutter to random values...
Setting ISO to random values...
Setting aperture to random values...
Please switch to Av mode.
Setting EC to random values...
Setting Flash EC to random values...
Exposure tests completed.


Testing movie recording...
Please switch to Movie mode.

ML/SCRIPTS/API_TEST.LUA:1550: assertion failed!
stack traceback:
[C]: in function 'assert'
ML/SCRIPTS/API_TEST.LUA:1550: in function 'test_movie'
ML/SCRIPTS/API_TEST.LUA:1581: in function <ML/SCRIPTS/API_TEST.LUA:1564>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:1564: in function 'api_tests'
ML/SCRIPTS/API_TEST.LUA:1603: in main chunk

Movie record (no raw and record key not set in ML menu) stopped automatically and then assertion was triggered.
Blue Led was ON but went OFF when switching back to photo mode and camera powered down normally.

Running test_lens_focus() in nightly Jul03-18:

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-19 17:45:18
===============================================================================

Module tests...
Focus distance: 0
Focusing backward...
Focus distance: 0
Focusing forward with step size 3, wait=true...
......................
Focus distance: 0
Focusing backward with step size 3, wait=true...
.....
Focus distance: 0
Focus range: 22 steps forward, 5 steps backward.
Focusing forward with step size 3, wait=false...
......
Focus distance: 0
Focusing backward with step size 3, wait=false...
.....
Focus distance: 0
Focus range: 6 steps forward, 5 steps backward.
Focusing forward with step size 2, wait=true...
...........................................
Focus distance: 0
Focusing backward with step size 2, wait=true...
.....
Focus distance: 0

Camera shutdown automatically after AF test went back and forth up to Soft Autofocus limits

All test up to  test_io():

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-19 17:57:11
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
camera = table:
  shutter = table:
    raw = 0
    apex = -7.
    ms = 0
    value = 0
  aperture = table:
    raw = 32
    apex = 3.
    value = 2.799999
    min = table:
      raw = 32
      apex = 3.
      value = 2.799999
    max = table:
      raw = 88
      apex = 10
      value = 32
  iso = table:
    raw = 104
    apex = 9
    value = 1600
  ec = table:
    raw = -3
    value = -0.375
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5500
  mode = 2
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 158
  state = 0
  bulb = function: p
  shoot = function: p
  reboot = function: p
event = table:
  pre_shoot = nil
  post_shoot = nil
  shoot_task = nil
  seconds_clock = nil
  keypress = nil
  custom_picture_taking = nil
  intervalometer = nil
  config_save = nil
console = table:
  write = function: p
  clear = function: p
  hide = function: p
  show = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  stop = function: p
  pause = function: p
  wait = function: p
  info = function: p
  start = function: p
  resume = function: p
lens = table:
  name = "17-50mm"
  focal_length = 0
  focus_distance = 14080
  hyperfocal = 0
  dof_near = 0
  dof_far = 0
  af = true
  af_mode = 0
  focus = function: p
display = table:
  idle = true
  height = 480
  width = 720
  line = function: p
  clear = function: p
  circle = function: p
  on = function: p
  screenshot = function: p
  rect = function: p
  pixel = function: p
  notify_box = function: p
  draw = function: p
  print = function: p
  load = function: p
  off = function: p
key = table:
  last = 0
  press = function: p
  wait = function: p
menu = table:
  visible = false
  new = function: p
  set = function: p
  block = function: p
  close = function: p
  get = function: p
  open = function: p
testmenu = userdata:
  value = 0
  name = "Script API tests"
  help = "Various tests for the Lua scripting API."
  help2 = "When adding new Lua APIs, tests for them should go here."
  advanced = 0
  depends_on = 0
  edit_mode = 0
  hidden = false
  icon_type = 5
  jhidden = false
  max = 0
  min = 0
  selected = true
  shidden = false
  starred = false
  submenu_height = 0
  submenu_width = 0
  unit = 0
  works_best_in = 0
  run_in_separate_task = 0
  select = function: p
  update = nil
  info = nil
  rinfo = nil
  warning = nil
movie = table:
  recording = false
  start = function: p
  stop = function: p
dryos = table:
  clock = 18
  ms_clock = 18579
  prefix = "IMG_"
  dcim_dir = table:
    exists = true
    create = function: p
    children = function: p
    files = function: p
    parent = table:
      exists = true
      create = function: p
      children = function: p
      files = function: p
      parent = table:
        exists = true
        create = function: p
        children = function: p
        files = function: p
        parent = nil
        path = "A:/"
      path = "A:/DCIM/"
    path = "A:/DCIM/109CANON/"
  config_dir = table:
    exists = true
    create = function: p
    children = function: p
    files = function: p
    parent = table:
      exists = true
      create = function: p
      children = function: p
      files = function: p
      parent = table:
        exists = true
        create = function: p
        children = function: p
        files = function: p
        parent = nil
        path = "A:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 2419
    folder_number = 109
    free_space = 1052512
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  shooting_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 2419
    folder_number = 109
    free_space = 1052512
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  date = table:
    wday = 3
    month = 4
    day = 19
    isdst = false
    min = 57
    hour = 17
    sec = 14
    yday = 1
    year = 2019
  directory = function: p
  call = function: p
  remove = function: p
interval = table:
  time = 10
  count = 0
  running = 0
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:30: in function <ML/SCRIPTS/API_TEST.LUA:29>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:29: in function 'print_table'
ML/SCRIPTS/API_TEST.LUA:75: in function 'generic_tests'
ML/SCRIPTS/API_TEST.LUA:634: in function 'api_tests'task = table:
  create = function: p
  yield = function: p
property = table:
Generic tests completed.

Module tests...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Done!
#38
Scripting Corner / Re: Lua Scripting (lua.mo)
April 18, 2019, 10:41:05 PM
I have problems running on 50D with a tamron 17-50mm wich doesn't report focus distance in focus tab.

Can't run because it lock the camera in both unified and lua_fix (tested unified feb 04-18 and appears to run up to AF test then camera powered down for uknow reasons).

This is what I got in the log of lua_fix:

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-18 20:12:47
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
camera = table:
  shutter = table:
    raw = 107
    apex = 6.375
    ms = 12
    value = 0.012048
  aperture = table:
    raw = 35
    apex = 3.375
    value = 3.2
    min = table:
      raw = 32
      apex = 3.
      value = 2.799999
    max = table:
      raw = 88
      apex = 10
      value = 32
  iso = table:
    raw = 80
    apex = 6.
    value = 200
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 149
  state = 0
  reboot = function: p
  bulb = function: p
  shoot = function: p
event = table:
  pre_shoot = nil
  post_shoot = nil
  shoot_task = nil
  seconds_clock = nil
  keypress = nil
  custom_picture_taking = nil
  intervalometer = nil
  config_save = nil
console = table:
  hide = function: p
  clear = function: p
  show = function: p
  write = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  start = function: p
  pause = function: p
  resume = function: p
  wait = function: p
  stop = function: p
  info = function: p
lens = table:
  name = "17-50mm"
  focal_length = 0
  focus_distance = 14080
  hyperfocal = 0
  dof_near = 0
  dof_far = 0
  af = true
  af_mode = 0
  focus = function: p
display = table:
  idle = true
  height = 480
  width = 720
  pixel = function: p
  screenshot = function: p
  rect = function: p
  circle = function: p
  clear = function: p
  on = function: p
  print = function: p
  line = function: p
  notify_box = function: p
  off = function: p
  draw = function: p
  load = function: p
key = table:
  last = 0
  wait = function: p
  press = function: p
menu = table:
  visible = false
  new = function: p
  get = function: p
  block = function: p
  close = function: p
  open = function: p
  set = function: p
testmenu = userdata:
  value = 0
  name = "Script API tests"
  help = "Various tests for the Lua scripting API."
  help2 = "When adding new Lua APIs, tests for them should go here."
  advanced = 0
  depends_on = 0
  edit_mode = 0
  hidden = false
  icon_type = 5
  jhidden = false
  max = 0
  min = 0
  selected = true
  shidden = false
  starred = false
  submenu_height = 0
  submenu_width = 0
  unit = 0
  works_best_in = 0
  run_in_separate_task = 0
  select = function: p
  update = nil
  info = nil
  rinfo = nil
  warning = nil
movie = table:
  recording = false
  stop = function: p
  start = function: p
dryos = table:
  clock = 39
  ms_clock = 39732
  prefix = "IMG_"
  dcim_dir = table:
    exists = true
    create = function: p
    children = function: p
    files = function: p
    parent = table:
      exists = true
      create = function: p
      children = function: p
      files = function: p
      parent = table:
        exists = true
        create = function: p
        children = function: p
        files = function: p
        parent = nil
        path = "A:/"
      path = "A:/DCIM/"
    path = "A:/DCIM/109CANON/"
  config_dir = table:
    exists = true
    create = function: p
    children = function: p
    files = function: p
    parent = table:
      exists = true
      create = function: p
      children = function: p
      files = function: p
      parent = table:
        exists = true
        create = function: p
        children = function: p
        files = function: p
        parent = nil
        path = "A:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 2409
    folder_number = 109
    free_space = 1198336
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  shooting_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 2409
    folder_number = 109
    free_space = 1198336
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  date = table:
    hour = 20
    min = 12
    day = 18
    sec = 49
    month = 4
    year = 2019
    yday = 1
    wday = 2
    isdst = false
  call = function: p
  directory = function: p
  remove = function: p
interval = table:
  time = 10
  count = 0
  running = 0
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:30: in function <ML/SCRIPTS/API_TEST.LUA:29>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:29: in function 'print_table'
ML/SCRIPTS/API_TEST.LUA:75: in function 'generic_tests'
ML/SCRIPTS/API_TEST.LUA:634: in function 'api_tests'task = table:
  yield = function: p
  create = function: p
property = table:
Generic tests completed.

Module tests...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Testing exposure settings, module 'camera'...
Camera    : Canon EOS 50D (50D) 1.0.9
Lens      : 17-50mm
Shoot mode: 3
Shutter   : ,80 (raw 107, 0.012048s, 12ms, apex 6.375)
Aperture  : 3.2 (raw 35, f/3.2, apex 3.375)
Av range  : 2.8..32 (raw 32..88, f/2.799999..f/32, apex 3...10)
ISO       : 200 (raw 80, 200, apex 6.)
EC        : 0.0 (raw 0, 0 EV)
Flash EC  : 0.0 (raw 0, 0 EV)
Setting shutter to random values...

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-18 20:14:43
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
camera = table:
  shutter = table:
    raw = 115
    apex = 7.375
    ms = 6
    value = 0.006024
  aperture = table:
    raw = 35
    apex = 3.375
    value = 3.2
    min = table:
      raw = 32
      apex = 3.
      value = 2.799999
    max = table:
      raw = 88
      apex = 10
      value = 32
  iso = table:
    raw = 80
    apex = 6.
    value = 200
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 153
  state = 0
  bulb = function: p
  reboot = function: p
  shoot = function: p
event = table:
  pre_shoot = nil
  post_shoot = nil
  shoot_task = nil
  seconds_clock = nil
  keypress = nil
  custom_picture_taking = nil
  intervalometer = nil
  config_save = nil
console = table:
  hide = function: p
  show = function: p
  write = function: p
  clear = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  stop = function: p
  info = function: p
  pause = function: p
  start = function: p
  wait = function: p
  resume = function: p
lens = table:
  name = "17-50mm"
  focal_length = 0
  focus_distance = 14080
  hyperfocal = 0
  dof_near = 0
  dof_far = 0
  af = true
  af_mode = 0
  focus = function: p
display = table:
  idle = true
  height = 480
  width = 720
  pixel = function: p
  draw = function: p
  print = function: p
  screenshot = function: p
  off = function: p
  circle = function: p
  on = function: p
  load = function: p
  notify_box = function: p
  clear = function: p
  line = function: p
  rect = function: p
key = table:
  last = 0
  press = function: p
  wait = function: p
menu = table:
  visible = false
  set = function: p
  new = function: p
  get = function: p
  close = function: p
  block = function: p
  open = function: p
testmenu = userdata:
  value = 0
  name = "Script API tests"
  help = "Various tests for the Lua scripting API."
  help2 = "When adding new Lua APIs, tests for them should go here."
  advanced = 0
  depends_on = 0
  edit_mode = 0
  hidden = false
  icon_type = 5
  jhidden = false
  max = 0
  min = 0
  selected = true
  shidden = false
  starred = false
  submenu_height = 0
  submenu_width = 0
  unit = 0
  works_best_in = 0
  run_in_separate_task = 0
  select = function: p
  update = nil
  info = nil
  rinfo = nil
  warning = nil
movie = table:
  recording = false
  start = function: p
  stop = function: p
dryos = table:
  clock = 21
  ms_clock = 22024
  prefix = "IMG_"
  dcim_dir = table:
    exists = true
    create = function: p
    children = function: p
    files = function: p
    parent = table:
      exists = true
      create = function: p
      children = function: p
      files = function: p
      parent = table:
        exists = true
        create = function: p
        children = function: p
        files = function: p
        parent = nil
        path = "A:/"
      path = "A:/DCIM/"
    path = "A:/DCIM/109CANON/"
  config_dir = table:
    exists = true
    create = function: p
    children = function: p
    files = function: p
    parent = table:
      exists = true
      create = function: p
      children = function: p
      files = function: p
      parent = table:
        exists = true
        create = function: p
        children = function: p
        files = function: p
        parent = nil
        path = "A:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 2409
    folder_number = 109
    free_space = 1198336
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  shooting_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 2409
    folder_number = 109
    free_space = 1198336
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  date = table:
    min = 14
    isdst = false
    hour = 20
    year = 2019
    wday = 2
    month = 4
    sec = 45
    yday = 1
    day = 18
  remove = function: p
  directory = function: p
  call = function: p
interval = table:
  time = 10
  count = 0
  running = 0
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:30: in function <ML/SCRIPTS/API_TEST.LUA:29>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:29: in function 'print_table'
ML/SCRIPTS/API_TEST.LUA:75: in function 'generic_tests'
ML/SCRIPTS/API_TEST.LUA:634: in function 'api_tests'task = table:
  yield = function: p
  create = function: p
property = table:
Generic tests completed.

Module tests...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Testing exposure settings, module 'camera'...
Camera    : Canon EOS 50D (50D) 1.0.9
Lens      : 17-50mm
Shoot mode: 3
Shutter   : ,160 (raw 115, 0.006024s, 6ms, apex 7.375)
Aperture  : 3.2 (raw 35, f/3.2, apex 3.375)
Av range  : 2.8..32 (raw 32..88, f/2.799999..f/32, apex 3...10)
ISO       : 200 (raw 80, 200, apex 6.)
EC        : 0.0 (raw 0, 0 EV)
Flash EC  : 0.0 (raw 0, 0 EV)
Setting shutter to random values...
Error: shutter set to raw=97, got 0.03125s, expected 0.028656s
Error: shutter set to raw=97, got 31ms, expected 29ms
Error: shutter set to raw=97, got Tv5, expected Tv5.125
Error: shutter set to raw=97, got 96, expected 97 (raw)


This unified Jul 03-18:


===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-18 22:40:29
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
camera = table:
  shutter = table:
    raw = 83
    apex = 3.375
    ms = 96
    value = 0.096388
  aperture = table:
    raw = 32
    apex = 3.
    value = 2.799999
    min = table:
      raw = 32
      apex = 3.
      value = 2.799999
    max = table:
      raw = 88
      apex = 10
      value = 32
  iso = table:
    raw = 80
    apex = 6.
    value = 200
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 152
  state = 0
  reboot = function: p
  shoot = function: p
  bulb = function: p
event = table:
  pre_shoot = nil
  post_shoot = nil
  shoot_task = nil
  seconds_clock = nil
  keypress = nil
  custom_picture_taking = nil
  intervalometer = nil
  config_save = nil
console = table:
  clear = function: p
  write = function: p
  show = function: p
  hide = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  start = function: p
  stop = function: p
  resume = function: p
  pause = function: p
  wait = function: p
  info = function: p
lens = table:
  name = "17-50mm"
  focal_length = 0
  focus_distance = 14080
  hyperfocal = 0
  dof_near = 0
  dof_far = 0
  af = true
  af_mode = 0
  focus = function: p
display = table:
  idle = true
  height = 480
  width = 720
  print = function: p
  clear = function: p
  on = function: p
  pixel = function: p
  rect = function: p
  line = function: p
  draw = function: p
  load = function: p
  circle = function: p
  notify_box = function: p
  screenshot = function: p
  off = function: p
key = table:
  last = 0
  press = function: p
  wait = function: p
menu = table:
  visible = false
  set = function: p
  block = function: p
  close = function: p
  open = function: p
  get = function: p
  new = function: p
testmenu = userdata:
  value = 0
  name = "Script API tests"
  help = "Various tests for the Lua scripting API."
  help2 = "When adding new Lua APIs, tests for them should go here."
  advanced = 0
  depends_on = 0
  edit_mode = 0
  hidden = false
  icon_type = 5
  jhidden = false
  max = 0
  min = 0
  selected = true
  shidden = false
  starred = false
  submenu_height = 0
  submenu_width = 0
  unit = 0
  works_best_in = 0
  run_in_separate_task = 0
  select = function: p
  update = nil
  info = nil
  rinfo = nil
  warning = nil
movie = table:
  recording = false
  start = function: p
  stop = function: p
dryos = table:
  clock = 25
  ms_clock = 25387
  prefix = "IMG_"
  dcim_dir = table:
    exists = true
    create = function: p
    children = function: p
    files = function: p
    parent = table:
      exists = true
      create = function: p
      children = function: p
      files = function: p
      parent = table:
        exists = true
        create = function: p
        children = function: p
        files = function: p
        parent = nil
        path = "A:/"
      path = "A:/DCIM/"
    path = "A:/DCIM/109CANON/"
  config_dir = table:
    exists = true
    create = function: p
    children = function: p
    files = function: p
    parent = table:
      exists = true
      create = function: p
      children = function: p
      files = function: p
      parent = table:
        exists = true
        create = function: p
        children = function: p
        files = function: p
        parent = nil
        path = "A:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 2411
    folder_number = 109
    free_space = 1196608
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  shooting_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 2411
    folder_number = 109
    free_space = 1196608
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  date = table:
    yday = 1
    wday = 2
    year = 2019
    month = 4
    isdst = false
    day = 18
    hour = 22
    sec = 31
    min = 40
  directory = function: p
  remove = function: p
  call = function: p
interval = table:
  time = 10
  count = 0
  running = 0
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:30: in function <ML/SCRIPTS/API_TEST.LUA:29>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:29: in function 'globals.print_table'
ML/SCRIPTS/API_TEST.LUA:75: in function 'globals.generic_tests'
ML/SCRIPTS/API_TEST.LUA:634: in function 'globals.api_tests'task = table:
  yield = function: p
  create = function: p
property = table:
Generic tests completed.

Module tests...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-18 22:50:09
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
camera = table:
  shutter = table:
    raw = 147
    apex = 11.375
    ms = 0
    value = 0.000376
  aperture = table:
    raw = 0
    apex = 0
    value = 0
    min = table:
      raw = 0
      apex = 0
      value = 0
    max = table:
      raw = 0
      apex = 0
      value = 0
  iso = table:
    raw = 80
    apex = 6.
    value = 200
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 152
  state = 0
  shoot = function: p
  reboot = function: p
  bulb = function: p
event = table:
  pre_shoot = nil
  post_shoot = nil
  shoot_task = nil
  seconds_clock = nil
  keypress = nil
  custom_picture_taking = nil
  intervalometer = nil
  config_save = nil
console = table:
  clear = function: p
  show = function: p
  write = function: p
  hide = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  stop = function: p
  info = function: p
  pause = function: p
  wait = function: p
  resume = function: p
  start = function: p
lens = table:
  name = ""
  focal_length = 0
  focus_distance = 14080
  hyperfocal = 0
  dof_near = 0
  dof_far = 0
  af = false
  af_mode = 3
  focus = function: p
display = table:
  idle = true
  height = 480
  width = 720
  load = function: p
  clear = function: p
  on = function: p
  pixel = function: p
  screenshot = function: p
  rect = function: p
  line = function: p
  draw = function: p
  notify_box = function: p
  print = function: p
  circle = function: p
  off = function: p
key = table:
  last = 0
  wait = function: p
  press = function: p
menu = table:
  visible = false
  open = function: p
  close = function: p
  set = function: p
  new = function: p
  block = function: p
  get = function: p
testmenu = userdata:
  value = 0
  name = "Script API tests"
  help = "Various tests for the Lua scripting API."
  help2 = "When adding new Lua APIs, tests for them should go here."
  advanced = 0
  depends_on = 0
  edit_mode = 0
  hidden = false
  icon_type = 5
  jhidden = false
  max = 0
  min = 0
  selected = true
  shidden = false
  starred = false
  submenu_height = 0
  submenu_width = 0
  unit = 0
  works_best_in = 0
  run_in_separate_task = 0
  select = function: p
  update = nil
  info = nil
  rinfo = nil
  warning = nil
movie = table:
  recording = false
  stop = function: p
  start = function: p
dryos = table:
  clock = 70
  ms_clock = 71064
  prefix = "IMG_"
  dcim_dir = table:
    exists = true
    create = function: p
    children = function: p
    files = function: p
    parent = table:
      exists = true
      create = function: p
      children = function: p
      files = function: p
      parent = table:
        exists = true
        create = function: p
        children = function: p
        files = function: p
        parent = nil
        path = "A:/"
      path = "A:/DCIM/"
    path = "A:/DCIM/109CANON/"
  config_dir = table:
    exists = true
    create = function: p
    children = function: p
    files = function: p
    parent = table:
      exists = true
      create = function: p
      children = function: p
      files = function: p
      parent = table:
        exists = true
        create = function: p
        children = function: p
        files = function: p
        parent = nil
        path = "A:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 2411
    folder_number = 109
    free_space = 1196608
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  shooting_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 2411
    folder_number = 109
    free_space = 1196608
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  date = table:
    year = 2019
    wday = 2
    yday = 1
    min = 50
    month = 4
    hour = 22
    sec = 11
    day = 18
    isdst = false
  directory = function: p
  remove = function: p
  call = function: p
interval = table:
  time = 10
  count = 0
  running = 0
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:30: in function <ML/SCRIPTS/API_TEST.LUA:29>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:29: in function 'globals.print_table'
ML/SCRIPTS/API_TEST.LUA:75: in function 'globals.generic_tests'
ML/SCRIPTS/API_TEST.LUA:634: in function 'globals.api_tests'task = table:
  yield = function: p
  create = function: p
property = table:
Generic tests completed.

Module tests...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Testing exposure settings, module 'camera'...
Camera    : Canon EOS 50D (50D) 1.0.9
Lens      :
Shoot mode: 3
Shutter   : ,2500 (raw 147, 0.000376s, 0ms, apex 11.375)
Aperture  : 0.0 (raw 0, f/0, apex 0)
Av range  : 0.0..0.0 (raw 0..0, f/0..f/0, apex 0..0)
ISO       : 200 (raw 80, 200, apex 6.)
EC        : 0.0 (raw 0, 0 EV)
Flash EC  : 0.0 (raw 0, 0 EV)
Setting shutter to random values...
#39
Camera-specific Development / Re: Canon EOS R / RP
April 18, 2019, 01:35:17 PM
Canon released a new 1.2.0 firmware update for Eos R.
#40
Quote from: lorenzo353 on April 13, 2019, 10:46:00 AM
you can use Exiftool to extract modelId from raw (CR2, CR3) or jpeg.
Thanks, you just confirmed my initial thinking on how it was discovered for newer models

Quote from: lorenzo353 on April 13, 2019, 10:46:00 AM
for CR2 see this poster : https://github.com/lclevy/libcraw2/blob/master/docs/cr2_poster.pdf,
it is stored in Makernote
Had a look at the poster and it helped me to understand better how offsets are handled inside the file format :)

Quote from: lorenzo353 on April 13, 2019, 10:46:00 AM
you can also use craw2tool : https://github.com/lclevy/libcraw2/blob/master/user_manual.md
@lorenzo353 I also looked at your library when tried to manipulate exif tags in cr2 image, but if I don't remember wrong it's not minded to overwrite metadata.
Do you have any suggestions?
#41
You can find the exposure limit patch here.

It doesn't works on top of branches with the patch manager (ex crop_rec_4k), but should works good in nightly and lua_fix

Please reports if it's all ok.
#42
I mean compile with CONFIG_QEMU=y to enable qprintf in console.
Can't retrieve the exact command line now, should be appended after make command (tried in makefile one time and didn't worked with digic6 branch  so not sure about that method)
#43
Two reasons I have encountered which can make it hang there:
1. It reached firmware signature check and failed to pass
2. Some wrong address for patching cache or others in platform/m50/constants.h

Have you compiled with Qemu debugging messages enabled?

Firmware signature message are that kind of type (like this).
#44
Quote from: dfort on April 11, 2019, 08:31:35 PM
Another issue with the 1.0.2 port is getting the firmware signature. Following my own tutorial I defined CONFIG_HELLO_WORLD but it required a value for SIG_M50_102 or it would not compile and it didn't print "Hello World" on the LCD, much less print out the firmware signature.
Easy way is to use Qemu with a faked value in src/fw-signature.h and let it print what src/reboot.c expect to be :)

Quote from: dfort on April 11, 2019, 08:31:35 PM
One last piece of the puzzle:

platform/M50.102/Makefile.platform.default
FIRMWARE_ID     = 0x00000412 # Not sure where to find this
You can find it under "Canon CanonModelID Values" at https://sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html or https://github.com/lclevy/libcraw2/blob/54caceb6aa3ec8aff1ae3102a498cb5438a75d74/docs/cameras.txt

Are they discovered from image metadata?

Also usually last digits are printed on serial console by the camera at firmware startup (ex. K412) and is reported under Model ID of the rom dumper.
#45
Camera-specific Development / Re: Canon 7D Mark II
April 08, 2019, 03:21:34 PM
Looks like there is a newer 1.1.2 firmware for 7d2

KenSoftTh you can try to downgrade from 1.1.0 to 1.0.4 if your camera allow this or try to update stubs.S to the newer firmware.

In the second case just update your camera and the start by dumping the firmware with Portable rom dumper and then follow two tutorials for finding stubs
#46
Camera-specific Development / Re: Canon 7D Mark II
April 08, 2019, 02:44:20 PM
Even if you copy a sample module from other camera... it will be replaced when running "make zip".

If you want to use this method, look at console output to know what is getting compiled and after your see your selected module get compiled for 2nd time, then quickly copy and paste "modulename.mo" in modules/yourmodule path.

Otherwise you can simply use "make" and get only autoexec.bin compiled and then copy it into card.

At the moment ut is the only ML file needed in order to run Hello World and early d678 experiments
#47
You can try the FIR version of the rom dumper and ask a1ex for bootflag enabler (after that It is possibile to run custom binary on camera).

Then share the dump (send a PM) so we can work on an updated version (time consuming but it should be worth if there is collaboration) for 1.0.4.
#48
Found stubs for 800D 1.0.1 and 6D2 1.0.3 6D2 1.0.4; now they have possibility to join the party :)

You should be able to save a log from startup as the other d7 cameras (please test and report).
Next step will be to find bmp_vram_info for hello world code, then start to port ML.

Is there someone who has these cameras and is willing to try bootflag enabler?

edit: Updated 6D2 stubs list to 1.0.4
#49
Good! Giving m50 able to navigate menu, should be only a matter of time before it can also be archived on d7 cameras.
Archiving MMIO logs could also help to enhance emulation in the future.

I don't have a 77d, so my help likely end here; nevertheless the development is already in good hands.

P.S: Looks like only 6D2 and 800D are missing the party... a1ex, any roms dump available? :)
#50
Quote from: zLOST on March 29, 2019, 11:42:35 PM
Sorry for being a bit quiet. In the meantime i've played with the script, moved the format submenu to the one with general script settings (autoload_menu) and made up this page, where i've summarized current state:

http://ml.zlej.net/
Thank you for the sample image, I'll take a look at metadata as soon as possibile.

Was working on a refactor of your addition for format selection last couple of days.
I'm trying to find a way to don't mess code too much and avoid the current limitation to allow user to use custom tags also for exiv2,

Quote from: zLOST on March 29, 2019, 11:42:35 PM
There is a LensName issue with Samyang 85/1.4, but otherwise we should be pretty much set ;)
Can you try with the scripts version from the pending PR?

Quote from: zLOST on March 29, 2019, 11:49:24 PM
LensFun library, which is used by DarkTable, Gimp and RawTherapee, is trying to do some "intelligent" guessing and matching of exif data with existing lens profiles. They may use the LensType ID as well https://sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html#LensType because what for example my Sigma 150-500 is reporting as LensModel (just "150-500mm") is pretty much useless. I haven't checked lensfun sources, but they seem to be combining LensMake (when available) with LensModel and some variations of LensModel ("EF 70-200" versus "EF70-200" and so on).
I also think each software is guessing using some heuristics from focal length, lens ID an maybe others... camparing with an internal database to choose from.

Maybe just override metadatas in Exif and Canon Makernotes, may be sufficient. Avoiding inserting redundant info like Photo.LensMake (which will also avoid necessity to handle and save other field in script)