I'm trying to implement get_focal_length function:
// 0xFC43DF1C EFLensCom.GetFocalLength
int __attribute__((naked,noinline)) EFLensComGetFocalLength () {
asm volatile (
" movs r0, #0\n"
" push {r4, lr}\n"
" bl sub_fc43cd91\n"
" mov r4, r0\n"
" ldr r0, [r0, #36]\n"
" movs r1, #160\n"
" strb r1, [r0, #0]\n"
" movs r1, #0\n"
" ldr r0, [r4, #36]\n"
" strb r1, [r0, #1]\n"
" ldr r0, [r4, #36]\n"
" strb r1, [r0, #2]\n"
" movs r1, #3\n"
" ldr r0, [r4, #32]\n"
" str r1, [r0, #0]\n"
" mov r0, r4\n"
" bl sub_fc2f2c0f\n"
" ldr r0, [r4, #40]\n"
" ldrb r1, [r0, #1]\n"
" ldrb r0, [r0, #2]\n"
" add.w r0, r0, r1, lsl #8\n"
" uxth r1, r0\n"
" ldr r0, =0xfc43e274\n"
" bl sub_fc37fd9d\n"
" mov r0, r4\n"
" bl sub_fc43cdf5\n"
//" movs r0, #0\n"
" mov r0, r1\n" // focal length
" pop {r4, pc}\n"
".ltorg\n"
);
}
But when I call it, camera crashes with various causes.
When I call original function (0xFC43DF1C) using ptpcam - everything is ok.