SX60HS Porting - page 11 - DryOS Development - CHDK Forum supplierdeeply

SX60HS Porting

  • 915 Replies
  • 372272 Views
Re: SX60HS Porting
« Reply #100 on: 24 / March / 2016, 14:27:27 »
Advertisements
thank you all.  basic chdkptp(and gui) appear to work now.  I can transfer files, ls, etc,etc. Execute shutdown appears to cause a reboot.  Execute reboot does nothing.

Now returning to the camera side and building the software.  The CHDK menu is accessible by a short press of the play button. navigation seems to work. The menu is quite small and frequently flashes back and forth between the canon native display and the chdk menu display.

*

Offline reyalp

  • ******
  • 14118
Re: SX60HS Porting
« Reply #101 on: 24 / March / 2016, 16:12:23 »
thank you all.  basic chdkptp(and gui) appear to work now.  I can transfer files, ls, etc,etc. Execute shutdown appears to cause a reboot.  Execute reboot does nothing.
Nice work. The reboot isn't currently implemented for any of the d6 cams, so that's expected. Shutdown shouldn't trigger a reboot though, I'm not sure offhand how that would happen. Does the camera power on when you connect USB (without CHDK)?

Quote
Now returning to the camera side and building the software.  The CHDK menu is accessible by a short press of the play button. navigation seems to work. The menu is quite small and frequently flashes back and forth between the canon native display and the chdk menu display.
Some degree of flashing is normal. If you haven't implemented the active_bitmap_buffer (or don't have the right variable) it will be worse, and the CHDK display see may be out of date (e.g. you'll press an arrow key to change menu selection, but the old one will still be highlighted.)

The menu and OSD being small is expected, that's another broader issue that still needs to be resolved for D6. You can use a larger font in the menu to make it a bit more readable.
Don't forget what the H stands for.

Re: SX60HS Porting
« Reply #102 on: 24 / March / 2016, 18:47:45 »
Quote
Does the camera power on when you connect USB (without CHDK)?
No it doesn't power up, but it seems to reboot on shutdown while connected.

I don't know how to determine if the active_bitmap_buffer is valid except by searching the disassembly which suggested the current value to me. What should I check? It seems to me, looking at the sx50 lib.c, it should be possible to replace a lot of code in my lib.c, however, both the g7x and sx280 seem to have adopted a different approach which I am using for now.

I made an initial stab at capt_seq.c....interesting how many ways the camera can crash. My first attempt is similar to the g7x.  Depending on the dial position a menu does come up indicating the position, and then usually crashes a second or two later. I am able to shoot photos if I don't activate the CHDK menu. I'm still trying to digest the differences (in capt_seq) between mine, the g7x and the sx280.  I'll attach a zip for anyone interested, also symbols and dumps.
Is there something else that would be better to focus on before this?
Best strategy to debug?


*

Offline reyalp

  • ******
  • 14118
Re: SX60HS Porting
« Reply #103 on: 24 / March / 2016, 21:22:00 »
I don't know how to determine if the active_bitmap_buffer is valid except by searching the disassembly which suggested the current value to me. What should I check?
Does index the current bitmap buffer? It should switch between 0 and 1 when the canon firmware updates, and indexing the bitmap and opacity buffers with it should give you the current display.

Quote
It seems to me, looking at the sx50 lib.c, it should be possible to replace a lot of code in my lib.c, however, both the g7x and sx280 seem to have adopted a different approach which I am using for now.
sx50 is a digic 5 camera, so most of the bitmap and framebuffer related stuff is actually different.

Quote
Is there something else that would be better to focus on before this?
I'd suggest getting the kbd.c / kbd_task as complete as you can. It looks like the KEYS_MASKn entries don't match what's in the keymap.

The mask should be the bitwise OR of all the keys that are in a particular word of physw status, except KEY_POWER, which shouldn't be masked.
You should make sure the keys are defined correctly, for example by watching physw_status while pressing the keys.

Note, to unlock the keyboard in playback with USB connected, you can use
=post_levent_to_ui(4484)

I would also suggest verifying the propset. As a guess, I'd expect sx60 to use the same propset as g7x, since it's the same dryos version, but it might not be the case. Verifying the propset mostly involves changing settings in the canon UI and making sure the corresponding propcase has the expected value. For example, if you switch to M mode and set the shutter speed, you should see the APEX96 value in USER_TV, and after you have half pressed, you should see it in  TV and TV2 as well.

If you check a few with a range of IDs and they are all OK, it's probably safe to assume it's right.

You get get individual propcase values in chdkptp using
=return get_prop(id)
Or by name with something like
=p=require'propcase' return get_prop(p.TV)

I also use this chdkptp script: https://chdk.setepontos.com/index.php?topic=12759.0

I see you still have some FAKEDEF(..., 0) in stubs_min.S. As I mentioned earlier, this is a mistake: https://chdk.setepontos.com/index.php?topic=12532.msg127202#msg127202

Quote
Best strategy to debug?
My preferred strategy for debugging capt_seq is to use PTP, uart redirection, LogCameraEvent, and show camera log. You can see some examples of log calls in the g7x capt_seq.c

Note you have to be careful about where you put log in the assembly, it's up to you to make sure you don't trash registers or condition codes.

Once you have the log calls set up, use the following to start UART logging with reasonable sized buffers:
=call_event_proc('StopCameraLog') sleep(200) call_event_proc('StartCameraLog',0x20,0x6000) sleep(100) require'uartr'.start('A/test.log',true,0x8000)

then switch to rec and shoot or whatever you want to test, and call
=return call_event_proc('ShowCameraLog')
Then download test.log to see your log messages in sequence with the normal camera log output.

E.g.
Code: [Select]
00111020: UI:VTMUnLock
00111220: UI:cs override arb:0 rb:0x435ee300 i:0105
00111220: UI:ShootSeqToUI:0x00002006:adr:0x8340,Para:33600
00111220: UI:cs end m:0 arb:0 rb:0x435ee300 i:0105
00111220: UI:cs m:34 arb:0 rb:0x435ee300 i:0105
00111220: UI:ShtCon_SetPreCapt
00111220: UI:VTMLock
The UI:cs messages are mine, the others are normal camera logging.

capt_seq task (like many canon tasks) sits in a loop reading messages and doing things in response to them. Message 0 is sent when the camera is ready after half shoot (or before starting the shot if the user didn't wait). Message 1 is sent for an actual shot. Most of the others are responses to shooting related setting changes, but we don't do much with them.

The code path within the message 1 code can vary a lot depending on the shooting mode,  whether the user waited for half press etc.
The exposure override hook needs to be somewhere in message 0 code (probably very similar to sx280hs and g7x)
The remote hook should be somewhere shortly before the actual exposure starts
The raw hook should somewhere after the exposure has completed, but before the canon firmware has kicked off the jpeg process.

If the raw hook isn't implemented, CHDK scripted shoot() and various other features will not work correctly, even if you aren't using CHDK raw.

Don't forget what the H stands for.


Re: SX60HS Porting
« Reply #104 on: 25 / March / 2016, 17:11:34 »
Thanks, this is very useful.  I had to look at your latest code in version 4569 to see what you have done....I was a bit out of date. I modified the MASk....I did
=post_levent_to_ui(4484)

Now I seem to have removed the ability to get into the CHDK menu with a short press of the play button. I want to do this because I need to enable lua native calls. Perhaps there's another way? or an easy way to re-enable the short key press...it might be mapped to another key but I haven't found it.

Most of the key settings were copied from platform/sx60hs/sub/100f/stubs_entry.S where they appear as comments....is this actually supposed to work:
<pre>
// Keymap values for kbd.c. Additional keys may be present, only common values included here.
// WARNING: Values only verified on sx280hs (R52) and g7x (R55p6) errors likely on other cams!
//KeyMap keymap[] = {
//    { 0, KEY_SHOOT_FULL      ,0x00040001 }, // Found @0xfc5cfb3c, levent 0x01
//    { 0, KEY_SHOOT_HALF      ,0x00040000 }, // Found @0xfc5cfbc4, levent 0x00
//    { 0, KEY_SHOOT_FULL_ONLY ,0x00000001 }, // Found @0xfc5cfb3c, levent 0x01
   </pre>

oh, and i got rid of all the FAKEDEFs but then I had lots of trouble with unresolved references,  I looked at your most recent checkedin code and you still have a few.

Re: SX60HS Porting
« Reply #105 on: 25 / March / 2016, 17:25:41 »
I want to do this because I need to enable lua native calls. Perhaps there's another way?
Modify the source code in your development build so that it's enabled by default?
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14118
Re: SX60HS Porting
« Reply #106 on: 25 / March / 2016, 17:42:48 »
Thanks, this is very useful.  I had to look at your latest code in version 4569 to see what you have done....I was a bit out of date.
I would strongly suggest doing your work in an SVN working copy. Then you can just update to get the latest. Since essentially everything you are doing is in your platform directory, there shouldn't be conflicts. I have continued to improve finsig tools, so regenerating stubs_entry.S may get you additional values.

Also, I notice you have ctypes and physw_sleep_delay overridden in stubs_min. I'd be would be very surprised if the sigfinder got either of these wrong.

Quote
I modified the MASk....I did
=post_levent_to_ui(4484)
This is a runtime thing, which will be reset on reboot. It just lets the canon firmware see key presses when you are connected to USB in playback mode.

For testing the key map, you are probably better off not sending this, since the physw_status bits should update but the canon firmware won't do anything with most of them.

To verify the key map using chdkptp, you can rmem physw_status address while each key pressed and unpressed:
rmem -i32 0x33f64 3

Beware that some unrelated values in physw_status may change randomly, so you should read the values a few times before concluding a key is in a particular bit.
Quote
Now I seem to have removed the ability to get into the CHDK menu with a short press of the play button.
Do you mean alt mode, or the CHDK menu? Normally, playback should toggle alt mode on / off, and menu should open the CHDK menu.

In any case, this is probably related to your key or mask changes. There's also the possibility that CHDK is actually going to alt mode, but the screen isn't updating.

Quote
I want to do this because I need to enable lua native calls. Perhaps there's another way?
You can build with OPT_FORCE_LUA_CALL_NATIVE=1 in your localbuildconf.inc

Quote
Most of the key settings were copied from platform/sx60hs/sub/100f/stubs_entry.S where they appear as comments....is this actually supposed to work:
It might, but in the past the event numbers have changed quite a lot. The things recognized are probably some key. Since your camera uses the same dryos rev as g7x, I would be moderately optimistic they are correct.


Quote
oh, and i got rid of all the FAKEDEFs but then I had lots of trouble with unresolved references,  I looked at your most recent checkedin code and you still have a few.
Sorry for the confusion. FAKEDEFS are OK (assuming you don't do anything that depends on those variables having real values), but the second parameter should not be 0, because it's a size (in 32 bit words) not a value. If you use 0, the value CHDK sees will be something else. If you do give a size, the value will always be zero, but you could initialize it somewhere in startup if you needed a different value.
« Last Edit: 25 / March / 2016, 17:48:11 by reyalp »
Don't forget what the H stands for.

Re: SX60HS Porting
« Reply #107 on: 25 / March / 2016, 18:50:02 »
Quote
Do you mean alt mode, or the CHDK menu? Normally, playback should toggle alt mode on / off, and menu should open the CHDK menu.
I meant alt-mode (from a short press of the play key).  Pressing menu, brings up the CANON menu...still...so I need to work on this.

Quote
Also, I notice you have ctypes and physw_sleep_delay overridden in stubs_min. I'd be would be very surprised if the sigfinder got either of these wrong.
I changed because sigfinder said this:

stubs_entry.S://DEF(physw_sleep_delay                 ,0x000082d0), ** != ** stubs_min = 0x000083d0 (0x000083d0)
stubs_entry.S://DEF(ctypes                            ,0xfc57bf28), ** != ** stubs_min = 0xfc57bf14 (0xFC57bf14)
and the disassembly supports sigfinder...I probably had a copy of stubs_min which I should have deleted. I should re-run sigfinder, i just worry it will wipe something and surprise me.

Quote
I would strongly suggest doing your work in an SVN working copy. Then you can just update to get the latest. Since essentially everything you are doing is in your platform directory, there shouldn't be conflicts. I have continued to improve finsig tools, so regenerating stubs_entry.S may get you additional values.
I am not terribly familiar with SVN...the code management system I use in my work is very very different, I need to gain comfort with it, I will try updating as you say. Hopefully it will not overwrite any local changes in config (like capstone)...first i will back up  :) I definitely hope finsig gets better and better.  As I said, my first attempt, was without finsig, and it took a very long time to find each signature by hand. Will it be possible to do this purely in perl without capstone in the future I wonder?




Re: SX60HS Porting
« Reply #108 on: 25 / March / 2016, 19:17:53 »
Hopefully it will not overwrite any local changes in config (like capstone)...first i will back up  :)
FWIW, the svn diff command is incredibly useful and quick for making local snapshots of your changes.  I use it frequently in a simple script to create local incremental backups as I work. Never mind overwriting something important when updating your local copy from the  svn, it's handy to be able roll back a local change "just because".
Ported :   A1200    SD940   G10    Powershot N    G16

Re: SX60HS Porting
« Reply #109 on: 25 / March / 2016, 19:27:02 »
Thanks waterwingz, I will experiment, play, with svn until I feel comfortable.
reyalp, my first attempt at uart redirect...I output the value of the  active_bitmap_buffer variable in lib.c.  tagged with "lc ai:"  It alternates from 0,1.
thanks, I like being able to do this....

Code: [Select]
uartr.lua: start UART redirection

00020490: *** Camera Log Start ***
00020500: lc  ai:1
00020650: System.Create
00020670: UI:VTMLock
00020670: UI:VTMUnLock
00020680: StartRedirectUART
00020680: lc  ai:0
00020700: Printf
00020760: UI:VTMLock
00020760: UI:VTMUnLock
00020770: lc  ai:1
00052610: UI:LogicalEvent:0x00001184:adr:0,Para:0
00052620: UI:VTMLock
00052620: UI:VTMUnLock
00052630: lc  ai:0
00058780: UI:Button:0x0000082A:PressMenuButton
00059370: UI:Button:0x0000082B:UnpressMenuButton
00065200: UI:Button:0x000010B4:DisconnectUSBCable
00065200: UI:USBDisconnect
00065200: PTPRspnd.ShutDownPTPFrameworkClient
00065210: UI:LogicalEvent:0x00001182:adr:0,Para:0
00065210: UI:AC:ShtPC
00065210: UI:TurnOnDisplay
00065230: UI:DispSwCon_DisableMute
00065230: UI:DispSw: Start
00065230: UI:DSIC:e2,0
00065230: UI:SetDisplayType
00065230: UI:VTMLock
00065230: UI:DispSw: After
00065230: UI:DSIC:e4,0
00065230: UI:VTMUnLock
00065240: UI:DispSwCon_TurnOnBackLight
00065240: UI:TurnOnBackLight
00065320: UI:Window MuteOff
00065320: UI:MuteOffPhysicalScreen
00065320: UI:DispSw: Done
00065320: UI:TurnOffBackLight
00065320: UI:DSIC:e4,0
00065320: UI:TurnOnBackLight
00065330: UI:AC:InitPB
00065330: UI:DCIC:0,16388
00065330: UI:_BeforeCBRForPlay
00065330: UI:_AfterCBRForPlay
00065330: UI:ExtMicCon::ExtMicCon_NotifyRecMode
00065330: SS:ToPlay
00065330: UI:AC:StartPB[2]
00065330: UI:DispSwCon_TurnOnDisplayDevice
00065330: UI:PB.Start
00065330: UI:VTMLock
00065330: UI:PB.Create
00065340: UI:LogicalEvent:0x0000301c:adr:0,Para:0
00065340: UI:PB.CreateE
00065340: UI:LogicalEvent:0x00003201:adr:0,Para:0
00065340: UI:DSIC:47,0
00065340: UI:CC_CompFlhJpg
00065340: UI:_CompFlhJpg
00065340: UI:PB.Flash
00065340: UI:PB.GRInitFileStore
00065340: UI:PB.S_Meta
00065350: UI:LogicalEvent:0x00003221:adr:0x1cc1050,Para:30150736
00065350: UI:DSIC:47,0
00065350: UI:LogicalEvent:0x0000320b:adr:0,Para:0
00065350: UI:VTMUnLock
00065360: UI:PB.StartE
00065360: UI:DispSW: Set
00065360: UI:_ChangeDisplayOut
00065360: UI:DSIC:e4,0
00065360: UI:_HandleSeparatorEvent
00065360: UI:_ChangeDisplayOut
00065360: UI:_DecideModeDial
00065360: UI:DSIC:e9,0
00065360: UI:DCIC:1,0
00065360: UI:AC:EnryPB
00065360: UI:DCIC:1,0
00065360: UI:AP:ChkCnctUSB
00065360: UI:PB.MAX_ID
00065360: UI:PB.FoundMaxIDF
00065360: UI:PB.RefPB
00065360: UI:VTMLock
00065360: UI:PB.SPC_SFirstCameraObject
00065360: UI:DSIC:47,0
00065390: UI:IPS.ReadI
00065390: UI:Err:0
00065390: UI:IPS.DrawI
00065410: UI:PB.DPOF
00065420: UI:LogicalEvent:0x00003220:adr:0,Para:0
00065420: UI:PB.CTG
00065420: UI:PB.Check_S
00065450: UI:LogicalEvent:0x0000301d:adr:0x4,Para:4
00065560: UI:IPS.DComp:0
00065560: UI:LogicalEvent:0x00003204:adr:0,Para:0
00065570: UI:PB.Check_E
00065570: UI:DSIC:21,6557600
00065570: UI:PB.ADrawImage
00065570: UI:PB.DComplete_S
00065570: UI:DSIC:48,0
00065570: UI:PB.RfrsI
00065580: UI:PB.F_Dec_S
00065580: UI:PB.GRInitFileStore
00065580: UI:LogicalEvent:0x00003202:adr:0,Para:0
00065580: UI:PB.F_Dec_E
00065580: UI:PB.DCompleteRefresh
00065580: UI:VTMUnLock
00065590: UI:SetSyncroDisplayDeviceController
00065620: UI:DSIC:48,0
00065620: UI:PB.DComplete_E
00065620: UI:DSIC:e4,0
00065620: UI:DispSwCon_TurnOnBackLight
00065620: UI:DispSwCon_MuteOffPhysicalScreen
00065620: UI:Window MuteOff
00065620: UI:MuteOffPhysicalScreen
00065630: UI:LogicalEvent:0x0000301d:adr:0x5,Para:5
00065630: UI:DSIC:21,6557600
00068540: UI:Button:0x0000082A:PressMenuButton
00068540: UI:VTMLock
00068540: SS:IsLens=0
00068610: UI:VTMUnLock
00068620: UI:VTMLock
00068620: UI:VTMReduuce
00068620: UI:VTM SW
00068620: UI:VTMUnLock
00068670: UI:VTMLock
00068670: UI:VTMUnLock
00068720: UI:VTMLock
00068720: UI:VTMUnLock
00068780: UI:VTMLock
00068780: UI:VTMUnLock
00068790: UI:VTMLock
00068790: UI:VTMUnLock
00068970: UI:Button:0x0000082B:UnpressMenuButton
00069570: UI:VTMLock
00069570: UI:VTMUnLock
00069620: UI:Button:0x0000082A:PressMenuButton
00069620: UI:VTMLock
00069630: UI:IPS.ReadI
00069630: UI:Err:0
00069630: UI:IPS.DrawI
00069800: UI:IPS.DComp:0
00069800: UI:PB.RfrsI
00069820: UI:DSIC:48,0
00069830: UI:VTMUnLock
00069830: UI:LogicalEvent:0x0000320f:adr:0,Para:0
00069950: UI:Button:0x0000082B:UnpressMenuButton
00074320: UI:LogicalEvent:0x0000301d:adr:0x4,Para:4
00074320: UI:DSIC:21,6557600
00074440: UI:LogicalEvent:0x0000301d:adr:0x5,Para:5
00074440: UI:DSIC:21,6557600
00074920: UI:LogicalEvent:0x0000301d:adr:0x4,Para:4
00074920: UI:DSIC:21,6557600
00075090: UI:Button:0x000010B3:ConnectUSBCable
00075090: UI:IntPcCnct
00075090: UI:DlvrUSBCnct
00075090: UI:_CnctUSBCBR
00075100: UI:LogicalEvent:0x00003138:adr:0,Para:0
00075100: PTPRspnd.StartUpPTPFrameworkClient
00075700: UI:LogicalEvent:0x0000301d:adr:0x5,Para:5
00075700: UI:DSIC:21,6557600
00075700: UI:LogicalEvent:0x00001181:adr:0,Para:0
00075720: UI:AC:PB2PC
00075720: UI:DispSwCon_MuteOnPhysicalScreen
00075720: UI:Window MuteOn
00075720: UI:MuteOnPhysicalScreen
00075720: UI:AC:ExitPB
00075720: UI:PB.ShutdownPBModeWith_S
00075720: UI:PB.RestartSPBMode_S
00075720: UI:PB.EndPMenu
00075720: UI:VTMLock
00075720: UI:VTMUnLock
00075720: UI:LogicalEvent:0x00003137:adr:0,Para:0
00075720: UI:PB.RestartSPBMode_E
00075720: UI:PB.ShutdownPBModeWith_E
00075720: UI:PB.ShutdownPBModeSecond_S
00075720: UI:PB.EndPub
00075720: UI:PB._ShutdownPBModeThird_S
00075720: UI:PB._ShutdownPBMode4th_S
00075720: UI:PB.EndCtr
00075740: UI:VTMLock
00075740: UI:VTMUnLock
00075750: UI:VTMLock
00075750: UI:VTMReduuce
00075750: UI:PB.EndStopMeta
00075750: UI:DSIC:48,0
00075750: UI:PB._ShutdownPBMode4th_Shut
00075750: UI:LogicalEvent:0x00003203:adr:0,Para:0
00075750: UI:PB._ShutdownPBMode4th_E
00075750: UI:PB._ShutdownPBModeThird_E
00075750: UI:PB.ShutdownPBModeSecond_E
00075750: UI:VTM SW
00075750: UI:VTMReduuce
00075750: UI:DCIC:0,8
00075760: UI:DispSwCon_MuteOnPhysicalScreen
00075760: UI:Window MuteOn
00075760: UI:MuteOnPhysicalScreen
00075760: UI:DispSwCon_TurnOffDisplayDevice
00075760: UI:DispSwCon_TurnOffBackLight
00075760: UI:TurnOffBackLight
00075760: UI:TurnOffDisplay
00075890: UI:AP:ChkDiscnctUSB
00075890: UI:VTM SW
00075890: UI:VTMUnLock
00093960: UI:VTMLock
00093970: ShowCameraLog

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal