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

#151


This show up when lua.mo is loaded with mlv_rec.mo and a lot of modules loaded.

Enabling only lua.mo and mlv_rec.mo will not shows this error but Raw recording is not working in both cases (Camera freezes after recording is stopped).
It works only without Lua loaded.

Recording works fine with mlv_lite but I get this even without Lua loaded if a lot of modules are enabled:




Tested with manual_lens_info.2018Feb19 build and without enabling any script.
Note: I can see crop_rec.mo into modules list. Is this correct or should appears only in 4k branch?
#152
Quote from: nikfreak on April 01, 2018, 11:19:04 AM
Does this already allow to "overwrite / assign" an attached cpu lens to be one of the list of supported non-cpu lenses??
Yes, It was extended to support adapters with AF confirm Chip.
There is a check which detect when adapter is used, it's based primarily on lens's name/focal length returned by chip (observed "1-65535mm" the one I have).

You have to disable this check if you want to override EF-S lenses, but shouldn't be the case you are talking about.

Quote from: dfort on February 16, 2018, 05:16:50 PM
Saving XMP when shooting silent MLV files should also be addressed.
I was thinking to add a check inside xmp's lib to see which file format is selected.
Initially I was unsure if this could interfere with ML normal functionality like deflickr.mo because it need to save a .xml, but as this issues is present when silent.mo is used and it already have a function to check which file format is selected.

Is it possible to link code between modules? From silent.c to lua_camera.c? (Aldo I don't remember if silent.h exists)
#153
Done more patterns matching and got more stubs:

NSTUB(0xFFD0C558, CreateRecursiveLock) // **"CreateRecursiveLock"
NSTUB(0xFFD04B74, AcquireRecursiveLock)
NSTUB(0xFFD04C9C, ReleaseRecursiveLock) // AJ_KernelDry_KerRLock.c_p2
NSTUB(0xFFD05330, give_semaphore)
NSTUB(0xFF867778, gui_change_lcd_state_post)
NSTUB(0xFF866BEC, gui_change_mode)
NSTUB(0xFF8676B8, gui_change_shoot_type_post)
NSTUB(0xFF8645FC, gui_init_end)
NSTUB(0xFF8B6344, gui_init_event) // to be checked
NSTUB(0xff866fb8, gui_local_post)
NSTUB(0xff864aec, gui_main_task) // jump in the middle of procedure
NSTUB(0xff865808, gui_massive_event_loop) // similar to 40d
NSTUB(0xff867454, gui_other_post) // similar to 40d
NSTUB(0xff8675e8, gui_post_10000062) // to be checked
NSTUB(0xff95eb24, gui_task_create)
NSTUB(0xff95ec74, gui_task_destroy)
NSTUB(0xffd03694, gui_timer_something)
NSTUB(0xffd1cc88, AllocateMemory)
NSTUB(0xffd1cc88, _AllocateMemory)
NSTUB(0xffd1ccc8, FreeMemory)
NSTUB(0xffd1ccc8, _FreeMemory)
NSTUB(0xff97fd54, RedrawDisplay) // to be checked
NSTUB(0xffd18028, alloc_dma_memory) // takes one less parameter
NSTUB(0xffd18028, _alloc_dma_memory) // takes one less parameter
NSTUB(0xffd1ccc8, free) // not good points to FreeMemory
NSTUB(0xffd1ccc8, _free) // not good points to FreeMemory
NSTUB(0xffd56d2c, free_dma_memory)
NSTUB(0xffd56d2c, _free_dma_memory)
NSTUB(0xffd1cd98, GetMemoryInformation) // to be checked
NSTUB(0xFFD20B28, AllocateMemoryResource) // m_pfAllocMemoryCBR
NSTUB(0xFFD20B7C, AllocateContinuousMemoryResource) // m_pfContAllocMemoryCBR
NSTUB(0xFFD20BD0, FreeMemoryResource) // m_pfFreeMemoryCBR
NSTUB(0xFFD0931C, GetFirstChunkFromSuite) // AJ_PackMemory_PackMem_p3
NSTUB(0xFFD09154, GetMemoryAddressOfMemoryChunk)
NSTUB(0xFFD0C1A4, msg_queue_create) // **"CreateMessageQueue"
NSTUB(0xFFD046C0, msg_queue_post)
NSTUB(0xFFD03FDC, msg_queue_receive)

NSTUB(0xFFD0E6F8, vsnprintf) // to be checked
NSTUB(0xff8d9430, ErrForCamera_handler)  // jump in the middle of procedure // ERR70 ERR80 etc (DlgErrForCamera.c AJ_DIALOG.HANDLER_DlgErrForCamera.c)
NSTUB(0xff8c4f34, LiveViewApp_handler) // used procedure entry point instead jumping in the middle like 40d (to be checked)
NSTUB(0xff8a9bb8, PlayMain_handler) // jump in the middle of procedure
NSTUB(0xffc74fac, BmpDDev_give_semaphore)
NSTUB(0xffc74f5c, BmpDDev_take_semaphore)
NSTUB(0xFFD04DA0, create_named_semaphore)
NSTUB(0xFFD05194, take_semaphore)

NSTUB(0xFFD31D8C, get_current_task)
NSTUB(0xFFD05C60, DeleteTask)
//NSTUB(0xFFD0062C, QueryTaskByName) // taken 40d pattern but jump in the middle of procedure
NSTUB(0xffd10074, create_task_cmd_shell)
NSTUB(0xffc3ecf4, _prop_cleanup) // similar, to be cheched
NSTUB(0xffc3ebd0, prop_register_slave)

I noticed that some stubs jump in the middle of a procedure and starts with a push to the stack. Is this correct?
Also some stubs form 40d like "malloc" and "free" have a comment stating "not good, points to FreeMemory/AllocateMemory" What need to be done?

Adding those stubs and this is what I currently get if I try to compile:

[ LD       ]   magiclantern
menu.o: In function `beta_should_warn':
menu.c:(.text+0xa3c): undefined reference to `LoadCalendarFromRTC'
menu.o: In function `handle_ml_menu_keys':
menu.c:(.text+0x7064): undefined reference to `LoadCalendarFromRTC'
gui.o: In function `ml_hijack_gui_main_task':
gui.c:(.text+0x264): undefined reference to `QueryTaskByName'
bmp.o: In function `set_ml_palette_if_dirty':
bmp.c:(.text+0x9d0): undefined reference to `PB_Palette'
config.o: In function `config_save_file':
config.c:(.text+0x7dc): undefined reference to `LoadCalendarFromRTC'
tweaks.o: In function `tweak_task':
tweaks.c:(.text+0xc): undefined reference to `LoadCalendarFromRTC'
lens.o: In function `clock_update':
lens.c:(.text+0x4f0): undefined reference to `LoadCalendarFromRTC'
bootflags.o: In function `bootflag_write_bootblock':
bootflags.c:(.text+0x238): undefined reference to `cf_device'
dialog_test.o: In function `get_current_dialog_handler':
dialog_test.c:(.text+0x14): undefined reference to `gui_task_list'
shoot.o: In function `display_idle':
shoot.c:(.text+0x368): undefined reference to `ShootOlcApp_handler'
zebra-5dc.o: In function `tic':
zebra-5dc.c:(.text+0xe08): undefined reference to `LoadCalendarFromRTC'
make: *** [magiclantern] Error 1

Solved most missing reference but "LoadCalendarFromRTC" is hard to track and I'm not sure about "QueryTaskByName"


// From 40D's stubs.s
//NSTUB(0x4AF8, gui_task_list)
//NSTUB(0x17530, gui_main_struct)
//NSTUB(0x314F8, cf_device)
//NSTUB(0x309C8, PB_Palette)
//NSTUB(0x2B24, task_max)

How can I find those RAM address?

Looking 40D "cstart" and "bzero32" are not used in stubs.s nor is warning during 1000D compilation. Does it need to be found at this stage or can get a working build to be run into qemu?
I need some time to read again M2 thread and look for something to try into emulation.
#154
Had some fun yesterday hunting for stubs and I noticed that I can find the same code at different address which differ by an offset...

This is using disassembply.pl with argument "0xFF000000":

NSTUB(0xFF4D6F1C, _FIO_GetFileSize)
NSTUB(0xFF4D5D1C, _FIO_OpenFile)
NSTUB(0xFF4D6C40, FIO_ReadFile)
NSTUB(0xFF4D6B7C, _FIO_RemoveFile)
NSTUB(0xFF4D6DB0, FIO_WriteFile) //CF_Test.bin


This is what I get if I use "0xFF800000" as argument to disassemble.pl. To a quick look it sems to match IDA Disassembly when hunting for loc_xxxxx (the are named sub_xxxx instead).

NSTUB(0xFF960420, CreateDialogBox)
NSTUB(0xFFD0D5F4, DryosDebugMsg)
NSTUB(0xFFCD6E68, FIO_FindClose)
NSTUB(0xFFCD6E68, FIO_CloseFile)
NSTUB(0xFFCD7090, _FIO_CreateDirectory)
NSTUB(0xFFCD6AB8, _FIO_CreateFile)
NSTUB(0xFFCD67E8, FIO_FindNextEx)
NSTUB(0xFFCD6F1C, _FIO_GetFileSize
NSTUB(0xFFCD5D1C, _FIO_OpenFile)
NSTUB(0xFFCD6C40, FIO_ReadFile)
NSTUB(0xFFCD6B7C, _FIO_RemoveFile)
NSTUB(0xFFCD6DB0, FIO_WriteFile) //tracing "CF_Test.bin"
NSTUB(0xFF865060, GUI_Control)
NSTUB(0xFF896184, GUI_GetFirmVersion)
NSTUB(0xFF8DD5DC, GuiEdLedBlink)
NSTUB(0xFF8DD5AC, GuiEdLedOff)
NSTUB(0xFF8DD57C, GuiEdLedOn)
NSTUB(0xFFD05708, msleep)
NSTUB(0xFFD05A54, task_create)
NSTUB(0xFF887050, SetGUIRequestMode) //not sure - take more argument but has same code pattern

Is code in ROM duplicated also into other smaller range instead of 0xF8000000? Do I need to prefer the second range?

What I do is using 40D's dump and stubs address to find what appears to be the same address into 1000D's disassembly, hunting for function starting with same arguments number and similar refs number, near strings or particular instructions.

Is this method of code pattern matching valid? How can I use qemu to help me in this stage?

#155
I had a look into this a couple of weeks ago, because I could have possibility to get a 1000D at a nearly bargain price which would be fun to play with it and learn how to reverse code.
So I found a dump of 1.0.5 to run into Qemu and started to analyze it.

However, while trying to find some stubs, I have noticed different patterns into disassembled code of 1000D compared to more recent cameras (50D)
Even simple stubs which can be found searchng for strings and then go up a couples of lines, they get hard to track for the function's entry point.

Having a dump of a 40D or 450D syde by side to 1000D could help understanding what to look for stubs and get development at the same point of the other two.
#156
Scripting Corner / Re: Lua Scripting (lua.mo)
February 21, 2018, 01:28:07 PM
Run Stubs Api tests in dm-spy-experiment and lua_fix.
Only selftest module loaded and movie record enabled.

[Pass] is_play_mode() => 0x1
[Pass] src = fio_malloc(size) => 0x421140ac
[Pass] dst = fio_malloc(size) => 0x429180b8
[Pass] memcmp(dst, src, 4097) => 0xffffff31
[Pass] edmac_memcpy(dst, src, 4097) => 0x429180b8
[Pass] memcmp(dst, src, 4097) => 0x0
[Pass] edmac_memcpy(dst, src, 4097) => 0x429180b8
[Pass] memcmp(dst, src, size) => 0xffffff41
[Pass] edmac_memcpy(dst, src, size) => 0x429180b8
[Pass] memcmp(dst, src, size) => 0x0
[Pass] memcmp(dst, src, size) => 0xaf
[Pass] edmac_memcpy_start(dst, src, size) => 0x429180b8
       dt => 0x300a
[Pass] copied => 0x401000
[Pass] copied => 0x401000
[Pass] copied => 0x401000
[Pass] memcmp(dst, src, copied) => 0x0
[Pass] memcmp(dst, src, copied + 16) => 0xffffff7f
       edmac_memcpy_finish()
       free(src)
       free(dst)
Cache test A (EDMAC on BMP buffer)...
[Pass] bmp = bmp_load("ML/CROPMKS/CINESCO2.BMP", 1) => 0x1050d0
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x660
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x0
Cache test B (FIO on 8K buffer)...
[Pass] tries[0] => 0x10f
[Pass] tries[1] => 0xe5
[Pass] tries[2] => 0xf8
[Pass] tries[3] => 0xfc
[Pass] failr[0] => 0x7c
[Pass] failw[0] => 0x55
[Pass] failr[1] => 0x61
[Pass] failw[1] => 0x0
[Pass] failr[2] => 0x0
[Pass] failw[2] => 0x58
[Pass] failr[3] => 0x0
[Pass] failw[3] => 0x0
       times[0] / tries[0] => 0x1a
       times[1] / tries[1] => 0x1d
       times[2] / tries[2] => 0x19
       times[3] / tries[3] => 0x1c
Cache tests finished.

[Pass] f = FIO_CreateFile("test.dat") => 0x3
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
       FIO_CloseFile(f)
[Pass] FIO_GetFileSize("test.dat", &size) => 0x0
[Pass] size => 0x20000
[Pass] p = (void*)_alloc_dma_memory(0x20000) => 0x40990038
[Pass] f = FIO_OpenFile("test.dat", O_RDONLY | O_SYNC) => 0x3
[Pass] FIO_ReadFile(f, p, 0x20000) => 0x20000
       FIO_CloseFile(f)
       _free_dma_memory(p)
[Pass] count => 0x3a98
[Pass] buf = fio_malloc(0x1000000) => 0x421140ac
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000000
[Pass] f = FIO_OpenFile("test.dat", O_RDWR | O_SYNC) => 0x3
[Pass] FIO_SeekSkipFile(f, 0, SEEK_END) => 0x82000000
[Pass] FIO_WriteFile(f, buf, 0x10) => 0x10
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_END) => 0x81fffff0
[Pass] FIO_WriteFile(f, buf, 0x30) => 0x30
[Pass] FIO_SeekSkipFile(f, 0x20, SEEK_SET) => 0x20
[Pass] FIO_SeekSkipFile(f, 0x30, SEEK_CUR) => 0x50
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_CUR) => 0x30
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000020
[Pass] is_file("test.dat") => 0x1
[Pass] FIO_RemoveFile("test.dat") => 0x0
[Pass] is_file("test.dat") => 0x0
[Pass] SetTimerAfter(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0x1d7f4
       msleep(900)
[Pass] timer_func => 0x0
       msleep(200)
[Pass] timer_func => 0x1
[Pass] ABS((timer_time/1000 - t0) - 1000) => 0x6
[Pass] ABS((timer_arg - ta0) - 1000) => 0xa
[Pass] timer = SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0x1d7f6
       msleep(400)
       CancelTimer(timer)
[Pass] timer_func => 0x0
       msleep(1500)
[Pass] timer_func => 0x0
[Pass] SetHPTimerAfterNow(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetHPTimerAfterNow(100000, timer_cbr, overrun_cbr, 0) => 0x182
       msleep(90)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 100000) => 0x112
[Pass] ABS(DeltaT(timer_arg, ta0) - 100000) => 0xe3
[Pass] ABS((get_us_clock_value() - t0) - 110000) => 0x1f
[Pass] SetHPTimerAfterNow(90000, next_tick_cbr, overrun_cbr, 0) => 0x184
       msleep(80)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x3
       msleep(80)
[Pass] timer_func => 0x3
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 300000) => 0xc1
[Pass] ABS(DeltaT(timer_arg, ta0) - 300000) => 0x91
[Pass] ABS((get_us_clock_value() - t0) - 310000) => 0x39
       t0 = *(uint32_t*)0xC0242014 => 0x2c9bd
       msleep(250)
       t1 = *(uint32_t*)0xC0242014 => 0x6899e
[Pass] ABS(MOD(t1-t0, 1048576)/1000 - 250) => 0x5
       LoadCalendarFromRTC( &now )
       s0 = now.tm_sec => 0x18
       Date/time: 2018/02/21 12:40:24
       msleep(1500)
       LoadCalendarFromRTC( &now )
       s1 = now.tm_sec => 0x1a
[Pass] MOD(s1-s0, 60) => 0x2
[Pass] MOD(s1-s0, 60) => 0x2
       m0 = MALLOC_FREE_MEMORY => 0x22bd0
[Pass] p = (void*)_malloc(50*1024) => 0x106e18
[Pass] CACHEABLE(p) => 0x106e18
       m1 = MALLOC_FREE_MEMORY => 0x163d0
       _free(p)
       m2 = MALLOC_FREE_MEMORY => 0x22bd0
[Pass] ABS((m0-m1) - 50*1024) => 0x0
[Pass] ABS(m0-m2) => 0x0
       m0 = GetFreeMemForAllocateMemory() => 0x3a9e20
[Pass] p = (void*)_AllocateMemory(256*1024) => 0x98fff8
[Pass] CACHEABLE(p) => 0x98fff8
       m1 = GetFreeMemForAllocateMemory() => 0x369e14
       _FreeMemory(p)
       m2 = GetFreeMemForAllocateMemory() => 0x3a9e20
[Pass] ABS((m0-m1) - 256*1024) => 0xc
[Pass] ABS(m0-m2) => 0x0
       m01 = MALLOC_FREE_MEMORY => 0x22bd0
       m02 = GetFreeMemForAllocateMemory() => 0x3a9e20
[Pass] p = (void*)_alloc_dma_memory(256*1024) => 0x40990038
[Pass] UNCACHEABLE(p) => 0x40990038
[Pass] CACHEABLE(p) => 0x990038
[Pass] UNCACHEABLE(CACHEABLE(p)) => 0x40990038
       _free_dma_memory(p)
[Pass] p = (void*)_shoot_malloc(24*1024*1024) => 0x4211408c
[Pass] UNCACHEABLE(p) => 0x4211408c
       _shoot_free(p)
       m11 = MALLOC_FREE_MEMORY => 0x22bd0
       m12 = GetFreeMemForAllocateMemory() => 0x3a9e20
[Pass] ABS(m01-m11) => 0x0
[Pass] ABS(m02-m12) => 0x0
[Pass] suite = shoot_malloc_suite_contig(24*1024*1024) => 0x990028
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x1800000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x99004c
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x1800000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42114088
[Pass] UNCACHEABLE(p) => 0x42114088
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite_contig(0) => 0x990114
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x1be8000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x990138
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x1be8000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42114088
[Pass] UNCACHEABLE(p) => 0x42114088
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(64*1024*1024) => 0x990114
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x7
[Pass] suite->size => 0x4000000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x990138
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x1be8000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42114088
[Pass] UNCACHEABLE(p) => 0x42114088
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9901b0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x1bf4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42000064
[Pass] UNCACHEABLE(p) => 0x42000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990208
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x20dc000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5bb140e4
[Pass] UNCACHEABLE(p) => 0x5bb140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990280
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x25c4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x59b140e4
[Pass] UNCACHEABLE(p) => 0x59b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9902f8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2aac000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x57b140e4
[Pass] UNCACHEABLE(p) => 0x57b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990370
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2f94000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x55b140e4
[Pass] UNCACHEABLE(p) => 0x55b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9903e8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x4000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x54000064
[Pass] UNCACHEABLE(p) => 0x54000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0x4000000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(0) => 0x990114
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x12
[Pass] suite->size => 0xbf00000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x990138
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x1be8000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42114088
[Pass] UNCACHEABLE(p) => 0x42114088
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9901b0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x1bf4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42000064
[Pass] UNCACHEABLE(p) => 0x42000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990208
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x20dc000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5bb140e4
[Pass] UNCACHEABLE(p) => 0x5bb140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990280
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x25c4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x59b140e4
[Pass] UNCACHEABLE(p) => 0x59b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9902f8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2aac000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x57b140e4
[Pass] UNCACHEABLE(p) => 0x57b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990370
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2f94000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x55b140e4
[Pass] UNCACHEABLE(p) => 0x55b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9903e8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x4aa8000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x54000064
[Pass] UNCACHEABLE(p) => 0x54000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990460
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x65bc000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x56000064
[Pass] UNCACHEABLE(p) => 0x56000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9904d8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x80d0000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x58000064
[Pass] UNCACHEABLE(p) => 0x58000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990550
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x9be4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5a000064
[Pass] UNCACHEABLE(p) => 0x5a000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9905c8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xa0cc000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x53b140e4
[Pass] UNCACHEABLE(p) => 0x53b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990640
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xa5b4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x51b140e4
[Pass] UNCACHEABLE(p) => 0x51b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9906b8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xaa9c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4fb140e4
[Pass] UNCACHEABLE(p) => 0x4fb140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990730
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xaf84000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4db140e4
[Pass] UNCACHEABLE(p) => 0x4db140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9907a8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xb46c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4bb140e4
[Pass] UNCACHEABLE(p) => 0x4bb140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990820
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xb954000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x49b140e4
[Pass] UNCACHEABLE(p) => 0x49b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990898
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xbe3c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x47b140e4
[Pass] UNCACHEABLE(p) => 0x47b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990910
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xbf00000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x45b140e4
[Pass] UNCACHEABLE(p) => 0x45b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0xbf00000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] strlen("abc") => 0x3
[Pass] strlen("qwertyuiop") => 0xa
[Pass] strlen("") => 0x0
[Pass] strcpy(msg, "hi there") => 0x1853ec
[Pass] msg => 'hi there'
[Pass] snprintf(a, sizeof(a), "foo") => 0x3
[Pass] snprintf(b, sizeof(b), "foo") => 0x3
[Pass] strcmp(a, b) => 0x0
[Pass] snprintf(a, sizeof(a), "bar") => 0x3
[Pass] snprintf(b, sizeof(b), "baz") => 0x3
[Pass] strcmp(a, b) => 0xfffffff8
[Pass] snprintf(a, sizeof(a), "Display") => 0x7
[Pass] snprintf(b, sizeof(b), "Defishing") => 0x9
[Pass] strcmp(a, b) => 0x4
[Pass] snprintf(buf, 3, "%d", 1234) => 0x2
[Pass] buf => '12'
[Pass] memcpy(foo, bar, 6) => 0x1853c0
[Pass] foo => 'asdfghuiop'
[Pass] memset(bar, '*', 5) => 0x1853a0
[Pass] bar => '*****hjkl;'
       bzero32(bar + 5, 5)
[Pass] bar => '****'
       EngDrvOut(LCD_Palette[0], 0x1234)
[Pass] shamem_read(LCD_Palette[0]) => 0x1234
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       call("TurnOffDisplay")
[Pass] DISPLAY_IS_ON => 0x0
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       task_create("test", 0x1c, 0x1000, test_task, 0) => 0x57c00aa
[Pass] test_task_created => 0x1
[Pass] get_current_task_name() => 'run_test'
[Pass] task_max => 0x68
[Pass] task_max => 0x68
[Pass] mq = mq ? mq : (void*)msg_queue_create("test", 5) => 0x57e0084
[Pass] msg_queue_post(mq, 0x1234567) => 0x0
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x0
[Pass] m => 0x1234567
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x9
[Pass] sem = sem ? sem : create_named_semaphore("test", 1) => 0x5800146
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] take_semaphore(sem, 500) => 0x9
[Pass] give_semaphore(sem) => 0x0
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] give_semaphore(sem) => 0x0
[Pass] rlock = rlock ? rlock : CreateRecursiveLock(0) => 0x582005e
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0xf
       SetGUIRequestMode(1); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x1
       SetGUIRequestMode(2); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x2
       SetGUIRequestMode(0); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x0
[Pass] display_idle() => 0x1
       GUI_Control(BGMT_PLAY, 0, 0, 0); msleep(1000);
[Pass] PLAY_MODE => 0x1
[Pass] MENU_MODE => 0x0
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(1000);
[Pass] MENU_MODE => 0x1
[Pass] PLAY_MODE => 0x0
[Pass] dialog->type => 'DIALOG'
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x0
[Pass] PLAY_MODE => 0x0
       SW1(1,100)
[Pass] HALFSHUTTER_PRESSED => 0x1
       SW1(0,100)
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x1
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[FAIL] is_pure_play_photo_mode() => 0x1
[FAIL] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[FAIL] is_pure_play_photo_mode() => 0x1
[Pass] is_pure_play_movie_mode() => 0x0

3 Fails in dm-spy-experiment

12727 passed, 23-24 failed in lua_fix branch (I can't find log on CF). lv_focus_status test fails 2 or 3 times then appears to Pass, some UI_Lock errors in console.

After finishing test camera is locked up in a movie record and I need to remove battery.

I have also an hypothesis of a possible wrong stub regarding drawing on screen, due to be unable in attempt to port flexinfo to 50D. So I tried Redraw Test and nothing is show on screen only blue Led blinks 3 times. What should happen?
Draw rectangle test works.
#157
Scripting Corner / Re: Lua Scripting (lua.mo)
February 20, 2018, 02:02:37 AM
Patch works but I had to check indentation (tab character) otherwise makefile won't works:
diff --git a/platform/Makefile.platform.extras b/platform/Makefile.platform.extras
--- a/platform/Makefile.platform.extras
+++ b/platform/Makefile.platform.extras
@@ -50,6 +50,7 @@
# do not actually build the FIR - just the plain binary
# also clean the installer directory afterwards; we are not going to use the results, just make sure it builds
installer_check: | autoexec.bin
+ $(MAKE) -C $(INSTALLER_DIR)/$(ML_MODEL_DIR) clean
$(MAKE) -C $(INSTALLER_DIR)/$(ML_MODEL_DIR) autoexec-fir.bin
$(MAKE) -C $(INSTALLER_DIR)/$(ML_MODEL_DIR) clean



Quote from: a1ex on February 20, 2018, 01:41:08 AM
It's not exactly clear to me either. That 2 is the half-shutter unpress event; 1 is half-shutter press (module.h). Does it always happen on the first iteration, or it's random?

Do you want me to run the test more times to see if appears in other logs?
#158
Scripting Corner / Re: Lua Scripting (lua.mo)
February 20, 2018, 01:11:58 AM
Quote from: a1ex on February 20, 2018, 12:59:50 AM
The mutex.h error suggests it needs a "make clean" (the Makefiles won't figure this out on their own).
Pretty sure I have done it. Retried "make clean" from /50D.109 and also from root directory, but it show up again.

Quote from: a1ex on February 20, 2018, 12:59:50 AM
Reproduced the issue using the info from this log.
Can you explain what's wrong? :)
#159
Scripting Corner / Re: Lua Scripting (lua.mo)
February 20, 2018, 12:43:43 AM
Quote from: a1ex on February 19, 2018, 05:57:12 PM
can you print key.last right before the assertion?
It prints "2"

Quote from: a1ex on February 19, 2018, 06:30:40 PM
Got a quick test for you to run, from the dm-spy-experiments branch, compiled with CONFIG_DEBUG_INTERCEPT=y -- place this code in debug.c and select Don't click me:

"Make zip" fails and also lua is not compiled
../../scripts/lib/../../src/config.c:908:14: error: 'DISPLAY_IS_ON' undeclared (first use in this function)
         if (!DISPLAY_IS_ON) beep();
              ^
make[5]: *** [../../scripts/lib/config.o] Error 1

..............

[ MKDIR    ]   ML directory structure...
cp ../modules/*/*.mo /Users/alex/Desktop/pullML/tmp/platform/50D.109/zip/ML/modules/
/Library/Developer/CommandLineTools/usr/bin/make -C ../../installer/50D.109 autoexec-fir.bin
[ VERSION  ]   ../../platform/50D.109/version.bin
make[1]: *** No rule to make target `../../src/mutex.h', needed by `installer.o'.  Stop.
make: *** [installer_check] Error 2


But I copied ML files from zip folder and worked.
Her is the log file. Hope it helps

#160
Scripting Corner / Re: Lua Scripting (lua.mo)
February 19, 2018, 06:55:51 PM
I can't do at the moment. I'll try to report it before going to sleep.

One thing I noticed some time ago and stilo presente, is a very high CPU usage in Photo display maybe related to redrawing. Can refresh rate be reduced or stopped/starded on demand to save battery?
#161
Scripting Corner / Re: Lua Scripting (lua.mo)
February 19, 2018, 06:26:37 PM
It's semi transparent in PLAY mode (I don't remember if it was larger) an LV (moves up to avoid cover bottom bar info)
In Photo info it's not semi-transparent and it flickers a lot.
In Ml menu it get resized (show last 3 lines) and cover bottom bar (menu's .info and .info2)
#162
Scripting Corner / Re: Lua Scripting (lua.mo)
February 19, 2018, 06:12:16 PM
Quote from: a1ex on February 19, 2018, 05:57:12 PM
Reproduced in QEMU. The console also flickers a lot during the test - does it happen on real hardware?

Yes, It flicker also on real hardware (a little bit faster but it's still annoiyng) it may be canon's code redrawing photo info display, It doesn't flicker when in photo review mode.
It's me or some times ago console was displayed fullscreen and semi-transparent?
#163
Quote from: a1ex on February 19, 2018, 03:16:05 PM
Try "patch -p1" or "hg import".
Nothing to do, recloned remote repo but It's partially applied lo lens.h, lua_len.c and silent.c

I'm trying to apply patch after this commit:

Merged in bouncyball/magic-lantern-merged/crop_rec_4k (pull request #901)
Revision: 17069
Changeset: e1794eb89f68170728b40b0153bb693a2ab9ed4c [e1794eb89f68]

Maybe your local repo is a bit different from remote and so can't find references?
#164
Scripting Corner / Re: Lua Scripting (lua.mo)
February 19, 2018, 01:17:35 PM
Tested again with lua_fix build after camera's settings reset:

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2018-2-19 13:08:53
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 112
    apex = 7.
    ms = 8
    value = 0.007812
  aperture = table:
    raw = 48
    apex = 5.
    value = 5.6
    min = table:
      raw = 32
      apex = 3.
      value = 2.8
    max = table:
      raw = 88
      apex = 10.
      value = 32
  iso = table:
    raw = 0
    apex = 0
    value = 0
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5200
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 158
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  bulb = function: p
  burst = function: p
  reboot = function: p
  shoot = function: p
  wait = 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
  hide = function: p
  clear = function: p
  show = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  resume = function: p
  stop = function: p
  start = function: p
  info = function: p
  wait = function: p
  pause = function: p
lens = table:
  name = "17-50mm"
  focal_length = 32
  focus_distance = 0
  hyperfocal = 9688
  dof_near = 1552657632
  dof_far = 1000000
  af = true
  af_mode = 0
  focus = function: p
  autofocus = function: p
display = table:
  idle = nil
  height = 480
  width = 720
  line = function: p
  rect = function: p
  on = function: p
  print = function: p
  draw = function: p
  pixel = function: p
  clear = function: p
  screenshot = function: p
  load = function: p
  circle = function: p
  notify_box = function: p
  off = function: p
key = table:
  last = 20
  press = function: p
  wait = function: p
menu = table:
  visible = false
  new = function: p
  open = function: p
  set = function: p
  close = function: p
  block = function: p
  select = function: p
  get = function: p
movie = table:
  recording = false
  start = function: p
  stop = function: p
dryos = table:
  clock = 47
  ms_clock = 47855
  image_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/102CANON/"
  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 = 425
    folder_number = 102
    free_space = 746144
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  shooting_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 425
    folder_number = 102
    free_space = 746144
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  date = table:
    min = 8
    year = 2018
    day = 19
    wday = 65
    month = 2
    yday = 1
    sec = 54
    hour = 13
    isdst = false
  rename = function: p
  remove = function: p
  directory = function: p
  call = function: p
interval = table:
  time = 10
  count = 0
  running = false
  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:36: in function <ML/SCRIPTS/API_TEST.LUA:35>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:35: in function 'print_table'
ML/SCRIPTS/API_TEST.LUA:81: in function 'generic_tests'
ML/SCRIPTS/API_TEST.LUA:1338: in function 'api_tests'
ML/SCRIPTS/API_TEST.LUA:1364: in main chunktask = table:
  create = function: p
  yield = function: p
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
Rename test OK
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Start LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Start LiveView...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Start LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Start LiveView...
Start LiveView...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Start LiveView...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Start LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Enter PLAY mode...
Enter PLAY mode...
Canon GUI tests completed.

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Snap simulation test...
Single picture...
A:/DCIM/102CANON/IMG_0426.CR2: 20705356
A:/DCIM/102CANON/IMG_0426.JPG not found.
Two burst pictures...
Ideally, the camera should be in some continuous shooting mode (not checked).
A:/DCIM/102CANON/ABC_0427.CR2: 20686900
A:/DCIM/102CANON/ABC_0427.JPG not found.
A:/DCIM/102CANON/ABC_0428.CR2: 20690368
A:/DCIM/102CANON/ABC_0428.JPG not found.
Bracketed pictures...
A:/DCIM/102CANON/IMG_0429.CR2: 19010223
A:/DCIM/102CANON/IMG_0429.JPG not found.
A:/DCIM/102CANON/IMG_0430.CR2: 20691711
A:/DCIM/102CANON/IMG_0430.JPG not found.
A:/DCIM/102CANON/IMG_0431.CR2: 21265995
A:/DCIM/102CANON/IMG_0431.JPG not found.
Bulb picture...
Elapsed time: 11599
A:/DCIM/102CANON/IMG_0432.CR2: 11809061
A:/DCIM/102CANON/IMG_0432.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...

This time it taken more pictures but got an assert on test_keys() (I could hear half-shutter beep)


#165
Scripting Corner / Re: Lua Scripting (lua.mo)
February 19, 2018, 12:57:31 PM
Camera 50D

Got errors with manual_lens_info branch Feb19 (has Feb17 lua_fix changes):

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2018-2-19 12:39:29
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 101
    apex = 5.625
    ms = 20
    value = 0.020263
  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 = 104
    apex = 9.
    value = 1600
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5200
  mode = 3
  metering_mode = 4
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 152
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  bulb = function: p
  burst = function: p
  wait = 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:
  show = function: p
  hide = function: p
  write = function: p
  clear = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  start = function: p
  stop = function: p
  info = function: p
  wait = function: p
  pause = function: p
  resume = function: p
lens = table:
  name = "17-50mm"
  focal_length = 17
  focus_distance = 0
  hyperfocal = 5466
  dof_near = 11139225
  dof_far = 1000000
  af = true
  af_mode = 514
  autofocus = function: p
  focus = function: p
display = table:
  idle = nil
  height = 480
  width = 720
  rect = function: p
  off = function: p
  pixel = function: p
  print = function: p
  line = function: p
  circle = function: p
  on = function: p
  screenshot = function: p
  clear = function: p
  load = function: p
  notify_box = function: p
  draw = function: p
key = table:
  last = 20
  press = function: p
  wait = function: p
menu = table:
  visible = false
  get = function: p
  select = function: p
  new = function: p
  close = function: p
  open = function: p
  block = function: p
  set = function: p
movie = table:
  recording = false
  stop = function: p
  start = function: p
dryos = table:
  clock = 17
  ms_clock = 17951
  image_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/102CANON/"
  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 = 422
    folder_number = 102
    free_space = 818432
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  shooting_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 422
    folder_number = 102
    free_space = 818432
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  date = table:
    isdst = false
    min = 39
    yday = 1
    sec = 30
    wday = 65
    year = 2018
    day = 19
    month = 2
    hour = 12
  remove = function: p
  directory = function: p
  rename = function: p
  call = function: p
interval = table:
  time = 10
  count = 0
  running = false
  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:36: in function <ML/SCRIPTS/API_TEST.LUA:35>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:35: in function 'print_table'
ML/SCRIPTS/API_TEST.LUA:81: in function 'generic_tests'
ML/SCRIPTS/API_TEST.LUA:1338: in function 'api_tests'
ML/SCRIPTS/API_TEST.LUA:1364: in main chunktask = table:
  yield = function: p
  create = function: p
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
Rename test OK
File I/O tests completed.

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

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Snap simulation test...
Single picture...


Can find picture in CF but assertion is triggered:



Same errors with latest lua_fix nightly (Run some quick tests a month ago and if I remember correctly api_test was failing also before).

Camera in M mode, lens AF swith ON and 0,7GB free space on CF.

Edit: filename _MG_0424.CR2 , Should I try to reset Canon's setting?
#166
Quote from: a1ex on February 19, 2018, 12:04:17 AM
I've extracted a patch for crop_rec_4k with only the changes related to ELNS and 64-byte lens name (mlv_dump, mlv*, silent and lens.h), but I'm afraid I have no more energy left to run any tests today (so I'm not committing it yet). If you try it, please report back.

I can't apply patch to crop_rec_4k branch: (updated my local repository by pulling latest commits from remote)
patch -f -p0 --input=/Users/alex/Desktop/pullML/tmp/a1exPatch64.diff
can't find file to patch at input line 15
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|# HG changeset patch
|# User alex@thinkpad
|# Date 1518995384 -3600
|#      Mon Feb 19 00:09:44 2018 +0100
|# Branch crop_rec_4k
|# Node ID 804086b3e47771bd72ed123bdd797c608738bf4f
|# Parent  5138c0050854c3c44eb2de21cf63c445baa0b245
|* Experimental: 64Byte Extended Lens Name
|* mlv_dump.c: Fix duplicate ELNS Block processing
|* mlv_rec.c: Fix duplicate ELNS Block processing
|
|diff -r 5138c0050854 -r 804086b3e477 modules/lua/lua_lens.c
|--- a/modules/lua/lua_lens.c Sat Feb 17 22:37:51 2018 +0100
|+++ b/modules/lua/lua_lens.c Mon Feb 19 00:09:44 2018 +0100
--------------------------
No file to patch.  Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 75
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -r 5138c0050854 -r 804086b3e477 modules/mlv_lite/mlv_lite.c
|--- a/modules/mlv_lite/mlv_lite.c Sat Feb 17 22:37:51 2018 +0100
|+++ b/modules/mlv_lite/mlv_lite.c Mon Feb 19 00:09:44 2018 +0100
--------------------------
No file to patch.  Skipping patch.
3 out of 3 hunks ignored
can't find file to patch at input line 106
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -r 5138c0050854 -r 804086b3e477 modules/mlv_rec/mlv.c
|--- a/modules/mlv_rec/mlv.c Sat Feb 17 22:37:51 2018 +0100
|+++ b/modules/mlv_rec/mlv.c Mon Feb 19 00:09:44 2018 +0100
--------------------------
No file to patch.  Skipping patch.
7 out of 7 hunks ignored
can't find file to patch at input line 247
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -r 5138c0050854 -r 804086b3e477 modules/mlv_rec/mlv.h
|--- a/modules/mlv_rec/mlv.h Sat Feb 17 22:37:51 2018 +0100
|+++ b/modules/mlv_rec/mlv.h Mon Feb 19 00:09:44 2018 +0100
--------------------------
No file to patch.  Skipping patch.
2 out of 2 hunks ignored
can't find file to patch at input line 281
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -r 5138c0050854 -r 804086b3e477 modules/mlv_rec/mlv_dump.c
|--- a/modules/mlv_rec/mlv_dump.c Sat Feb 17 22:37:51 2018 +0100
|+++ b/modules/mlv_rec/mlv_dump.c Mon Feb 19 00:09:44 2018 +0100
--------------------------
No file to patch.  Skipping patch.
3 out of 3 hunks ignored
can't find file to patch at input line 347
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -r 5138c0050854 -r 804086b3e477 modules/mlv_rec/mlv_rec.c
|--- a/modules/mlv_rec/mlv_rec.c Sat Feb 17 22:37:51 2018 +0100
|+++ b/modules/mlv_rec/mlv_rec.c Mon Feb 19 00:09:44 2018 +0100
--------------------------
No file to patch.  Skipping patch.
7 out of 7 hunks ignored
can't find file to patch at input line 436
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -r 5138c0050854 -r 804086b3e477 modules/silent/silent.c
|--- a/modules/silent/silent.c Sat Feb 17 22:37:51 2018 +0100
|+++ b/modules/silent/silent.c Mon Feb 19 00:09:44 2018 +0100
--------------------------
No file to patch.  Skipping patch.
4 out of 4 hunks ignored
can't find file to patch at input line 473
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -r 5138c0050854 -r 804086b3e477 src/lens.h
|--- a/src/lens.h Sat Feb 17 22:37:51 2018 +0100
|+++ b/src/lens.h Mon Feb 19 00:09:44 2018 +0100
--------------------------
No file to patch.  Skipping patch.
1 out of 1 hunk ignored
Completed with errors, see above


Note: focus.c is also modified to avoid display problems when using lens with longer name
#167
Quote from: a1ex on February 18, 2018, 04:49:56 PM
Another issue: I had to delete the old config file (lens.cfg), otherwise got some errors in config.lua. I can try to reproduce if needed.

It's because menu are serialized in a different format now (tables), instead simple "config" are key -> value pairs to be backward compatible (is it ok, or i preferable to follow new format?)
#168
Thank you dfort for the extensive testing :D
Quote from: dfort on February 16, 2018, 05:16:50 PM
So it looks like you got the movie modes working and only need to get the ASSERT messages in still photo modes figured out. Saving XMP when shooting silent MLV files should also be addressed.

The ASSERT messages where introduced after a1ex's attempt to fix issues related to calling lua's property.
He said that a rework of lua's memory backend is necessary to address this problem, so we need to wait news from him.

Regarding sidecar generation when using MLV format, I don't remember if it was happening from before or can be caused by the fix regarding sidecar's filename.

I'll test and look if is an easy task... disabling xmp engine when mlv format is selected should fix this but I have no idea where this can be checked correctly.
#169
Quote from: dfort on February 16, 2018, 07:22:02 AM
Ok, let me know when it is ready to test. The easiest way to check it with the Zeiss Makro-Planar 100mm ZF.2 lens because the Zeiss ZF.2 lenses work out of the box with Adobe Camera Raw. That's how I first found out about the lens name length issue.

Fixed Typos introduced right before committing, I'll refactor later when I'm not in a hurry.

Particular attention should be paid to "ELNS" Block metadata. Please check validity with FRSP and Raw Rec (mlv_rec, mlv_lite).
Let me know  ;)
#170
I made a new PR with experimental 64byte lens name and config.lua rework.

@dfort Can you try it and check if extended name is saved correctly? I tested mostly with silent pictures and some raw video with mlv_rec, but no tests with mlv_lite.

New version of config's lib should be backward compatible with script which use previous version, but it needs to be tested further.
Maybe is better to post a description of what's changed in lua's discussion after a review.

EDIT: There is an issue with the refactor of config.lua code, It work with previous version but not with the one in the PR. I need to figure out where is the problem... I'll try tomorrow if I have some time
#171
Quote from: a1ex on February 09, 2018, 04:35:19 PM
This should also cover camera models that do not use 100CANON, but 100EOS5D or whatever. There are some unresolved issues with certain settings, such as _MG_1234 or custom image prefix settings on 5D3, maybe also other models (issues revealed by api_test.lua).

Yes, I made a quick test on a custom build and It appears to work. Thank You a1ex!
#172
Quote from: a1ex on February 09, 2018, 01:07:36 PM
@JohanJ:
However, XMPs are named nil0004.XMP, rather than IMG_0004.CR2. Does this happen for you?

It happens also to me, it's a problem I noticed before and asked for feedback some posts ago.
If I remember correcly, it showed up in the middle of developing and wasn't sure if was related to canon's settings.

I tried now with 04April build and .xmp file are named correctly.

EDIT: reproduced ASSERT. It showed up on first picture after enabling script. It's the first time I see it.
@a1ex maybe it is related to commit 396a8a9 or b0b332a
#173
Quote from: a1ex on February 02, 2018, 03:43:21 PM
Figured out the "black screen" issue; building an experimental build with the latest changes from aprofiti.
Good! This one doesn't has the experimental patch as it's still in local because was expected to be committed after solving config's lib refactor.

I have a question to you @a1ex: Do you prefer a new PR containing only the changeset related to lens_info.name, ELNS block and mlv_dump so it can be merged relatively fast in crop-rec-4k (and can be tested by users) or in manual_lens_info (as now it should have an updated mlv_dump and mlv_rec), or a PR with the continuation of manual_lens_info?

Work in progress:
- refactor of config.lua (causing a large dalay because a recursive implementation to allow traversing submenu is causing thrubles regarding scoping an passing tables as argument to allow copy by reference...)
- add apertureMin/apertureMax to be saved from lua script (already implemented, just needs to be committed), so can be saved in "ELSN" block and maybe implement in lens.lua a full lower and upper bound for aperure when no custom f-values specified (currently only lower bound is computed automatically)
- maybe add lens name to Flex Info to camera doesn't already have (also add support for 50D, doesn't seems easy as expected) to allow a quick check on which lens is selected without opening menu

Desidered:
- find a way to show current aperture in Photo info display. Can we use PatchManager to modify canon's aperture value displayed? Or better... Use Qemu's MPU Emulation to send a message to cpu regarding aperture?
#174
Scripting Corner / Re: Lua Scripting (lua.mo)
January 31, 2018, 03:57:00 PM
At the moment it doesn't seems to cause any problems with config's lib.
I'll check later the memory usage between older and newer implementation because at the moment I'm using a lot of stuffs to debug.

Maybe Lua garbage collector can be called after copying the new values from menu to config's data structure, before writing .cfg to card.
This will allow to free memory on each saving instead only on the first run if placed at the end of "lens.lua" initialization
#175
Scripting Corner / Re: Lua Scripting (lua.mo)
January 31, 2018, 01:49:06 PM
I noticed a strange behavior of umm_alloc while working on a modified version of "config.lua" which use recursion to traverse submenus and is used by a complex script:

I believe that memory isn't free when a local variable is declared inside a function or a large number of function call occurs.

So I decided to reproduce on a simple script:
-- Test umm_malloc heap
--
local num = 100000

--function property.LENS_NAME:handler(value)
--end

function testHeap()
  local t = {"1","2","3","4","5"}
  return t
end

for i=0, num, 1 do
  testHeap()
end

This one free heap correctly when ending.

But if I add a property.LENS_NAME:handler(value) to make it a complex script, I get:

num = 1000   -> free umm_heap: 236KB
num = 10000 -> free umm_heap: 222KB

Here I get always the same values when rebooting the camera, instead I noticied in the other script that some times umm_heap was 156KB and sometimes up to 222KB.

Is this a normal behavior or is there something to check inside the backend?