supplierdeeply

Powershot SX150 IS Porting Thread

  • 279 Replies
  • 50761 Views
Re: Powershot SX150 IS Porting Thread
« Reply #60 on: 06 / December / 2011, 15:21:08 »
Advertisements
In case you didn't see a previous post let me add that RAW is not working yet for the SX150.

but i really want the extra functions that i've been reading about, and especially the RAW, and exposure/aperture limits increased. also, where can i even get the hack for it anyway? i can't seem to find anywhere to download anything. there's nothing in the "downloads" section. is there a CHDK for dummies tutorial for this camera, or something? if anyone would see their way fit to give me a hand with that stuff, i sure would appreciate it. thanks a bunch.

Re: Powershot SX150 IS Porting Thread
« Reply #61 on: 07 / December / 2011, 11:16:33 »
Thanks philmoz,
I used the physw_status display to see that KEY_PLAYBACK is 0x40, KEY_VIDEO is 0x10 for this camera.  I then enabled the CAM_ADJUSTABLE_ALT_BUTTON.  What I found is that with these definitions the play and video buttons can indeed get you into alt mode, but they also perform their intended functions, even with the shortest key press.  So they will not work for this camera.  Since I like the disp button for "back" in the CHDK menu that leaves set+right for my alt key.

BTW what does alt_mode_key_mask do?  If I change the alt key to set+right do I need to change this?


Only for a limited set of buttons. For most cameras you need to enable the physw_status display code in gui_draw_debug_vals_osd() and take note of which bits change when you press the buttons. Note that the bits are normally 1 and go to 0 in physw_status when the buttons are pressed.

Phil.


*

Offline philmoz

  • *****
  • 3070
    • Photos
Re: Powershot SX150 IS Porting Thread
« Reply #62 on: 07 / December / 2011, 13:58:06 »
I used the physw_status display to see that KEY_PLAYBACK is 0x40, KEY_VIDEO is 0x10 for this camera.  I then enabled the CAM_ADJUSTABLE_ALT_BUTTON.  What I found is that with these definitions the play and video buttons can indeed get you into alt mode, but they also perform their intended functions, even with the shortest key press.  So they will not work for this camera.  Since I like the disp button for "back" in the CHDK menu that leaves set+right for my alt key.

Make sure the KEYS_MASK0, KEYS_MASK1 and KEYS_MASK2 values are correct. These are all the bit values of the camera buttons or'ed together for each of the three physw_status entries.

Quote
BTW what does alt_mode_key_mask do?  If I change the alt key to set+right do I need to change this?


Nothing that I can see (on the ports I've done). I remove this from kbd.c.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)

Re: Powershot SX150 IS Porting Thread
« Reply #63 on: 07 / December / 2011, 18:14:48 »
Make sure the KEYS_MASK0, KEYS_MASK1 and KEYS_MASK2 values are correct. These are all the bit values of the camera buttons or'ed together for each of the three physw_status entries.

Thanks again philmoz.
I changed #define KEYS_MASK2 (0x00007F00) to  (0x00007F50).  5 = 1(video) + 4(play).
Now it works fine.


Re: Powershot SX150 IS Porting Thread
« Reply #64 on: 07 / December / 2011, 19:23:15 »
I then enabled the CAM_ADJUSTABLE_ALT_BUTTON.  What I found is that with these definitions the play and video buttons can indeed get you into alt mode, but they also perform their intended functions, even with the shortest key press.
If you take a look at the my_kbd_read_keys() in kbd.c code for the IXUS120_SD940 , you will see how waldo use the variable altDownTimer to create a short/med/long press mechanism so that the DISP key can have 3 discrete functions (albeit technically the camera does the med & long part of the timing).  I think something like that might solve your problem and let you revert to a single key press ?

Ported :   A1200    SD940   G10    Powershot N    G16

Re: Powershot SX150 IS Porting Thread
« Reply #65 on: 08 / December / 2011, 00:50:22 »
Raw Data:
I thought I'd look at why raw is not being saved.  I have enabled saving raw.  The display shows the number of raws the card can hold.

As far as I can tell raw_data_available is never getting set.  I put this code into main.c just before the check if raw data is available:
sprintf(osd_buf, "Raw Avail: %d", raw_data_available);
draw_txt_string(2, 12, osd_buf, conf.osd_color);

the text always says Raw Avail:0

Any advice on what to check next?



Re: Powershot SX150 IS Porting Thread
« Reply #66 on: 10 / December / 2011, 13:33:36 »
vid_get_viewport_fb_d():

The lib.c routine loads the address from an address that holds 0.  I don't know how the dissassembly code below was created.  The original porter sgtrum has not been on the forum for a month so any help would be appreciated.

Jon


Code: [Select]
void *vid_get_viewport_fb_d()
{

/*
ROM:FF872090 ; =============== S U B R O U T I N E =======================================
ROM:FF872090
ROM:FF872090 ; LOCATION: ImagePlayer.c:0
ROM:FF872090
ROM:FF872090                 EXPORT _sub_FF872090__ImagePlayer.c__0
ROM:FF872090 _sub_FF872090__ImagePlayer.c__0         ; CODE XREF: _sub_FF882734__VisualHandle.c__154+1B4 p
ROM:FF872090                                         ; sub_FF882908+94 p ...
ROM:FF872090                 STMFD   SP!, {R1-R7,LR}
ROM:FF872094                 LDR     R7, =0x2710
ROM:FF872098                 LDR     R5, =0x2A70   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
ROM:FF87209C                 LDR     R3, =0x6CE
ROM:FF8720A0                 LDR     R2, =aImageplayer_c ; "ImagePlayer.c"
ROM:FF8720A4                 LDR     R0, [R5,#0x4C]
ROM:FF8720A8                 MOV     R1, R7
ROM:FF8720AC                 BL      sub_FF83A488
ROM:FF8720B0                 MOV     R0, #1
ROM:FF8720B4                 BL      sub_FF871280
ROM:FF8720B8                 CMN     R0, #1
ROM:FF8720BC                 BEQ     loc_FF87218C
ROM:FF8720C0                 LDR     R4, =0x37A4C
ROM:FF8720C4                 ADD     R1, R0, R0,LSL#2
ROM:FF8720C8                 LDR     R0, [R4,R1,LSL#2]
ROM:FF8720CC                 MOV     R3, #0
ROM:FF8720D0                 ADR     R2, sub_FF871988
ROM:FF8720D4                 ADD     R12, R4, R1,LSL#2
ROM:FF8720D8                 STR     R0, [R5,#0x58]   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
ROM:FF8720DC                 LDR     R1, [R12,#0xC]
ROM:FF8720E0                 STMEA   SP, {R1-R3}
ROM:FF8720E4                 LDR     R3, [R12,#8]
ROM:FF8720E8                 MOV     R2, #0
ROM:FF8720EC                 MOV     R1, #0
ROM:FF8720F0                 BL      _sub_FF918DA8__ImgDDev.c__6 ; LOCATION: ImgDDev.c:6
ROM:FF8720F4                 TST     R0, #1
ROM:FF8720F8                 LDRNE   R1, =0x6F4
ROM:FF8720FC                 LDRNE   R0, =aImageplayer_c ; "ImagePlayer.c"
*/

    return (void*)(*(int*) (0x2A70+0x58));       
}

Re: Powershot SX150 IS Porting Thread
« Reply #67 on: 10 / December / 2011, 13:39:09 »
vid_get_viewport_fb_d():
The lib.c routine loads the address from an address that holds 0.  I don't know how the dissassembly code below was created. 
That code look like something disassembled from the camera's primary.bin file with IDA. But the code in void *vid_get_viewport_fb() immediately above that routine uses a different return value than what the code snippet shows so maybe its from a different camera ?   I think sgtrum leaned on the sx130 ?

If you look at the vid_get_viewport_fb_d() for a couple of cameras,  you'll sort of see how people worked that out.  I'd start with the G12, SD980 and S95 off the top of my head.



« Last Edit: 10 / December / 2011, 13:46:50 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline philmoz

  • *****
  • 3070
    • Photos
Re: Powershot SX150 IS Porting Thread
« Reply #68 on: 10 / December / 2011, 16:56:17 »
vid_get_viewport_fb_d():

The lib.c routine loads the address from an address that holds 0.  I don't know how the dissassembly code below was created.  The original porter sgtrum has not been on the forum for a month so any help would be appreciated.

Jon


Code: [Select]
void *vid_get_viewport_fb_d()
{

/*
ROM:FF872090 ; =============== S U B R O U T I N E =======================================
ROM:FF872090
ROM:FF872090 ; LOCATION: ImagePlayer.c:0
ROM:FF872090
ROM:FF872090                 EXPORT _sub_FF872090__ImagePlayer.c__0
ROM:FF872090 _sub_FF872090__ImagePlayer.c__0         ; CODE XREF: _sub_FF882734__VisualHandle.c__154+1B4 p
ROM:FF872090                                         ; sub_FF882908+94 p ...
ROM:FF872090                 STMFD   SP!, {R1-R7,LR}
ROM:FF872094                 LDR     R7, =0x2710
ROM:FF872098                 LDR     R5, =0x2A70   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
ROM:FF87209C                 LDR     R3, =0x6CE
ROM:FF8720A0                 LDR     R2, =aImageplayer_c ; "ImagePlayer.c"
ROM:FF8720A4                 LDR     R0, [R5,#0x4C]
ROM:FF8720A8                 MOV     R1, R7
ROM:FF8720AC                 BL      sub_FF83A488
ROM:FF8720B0                 MOV     R0, #1
ROM:FF8720B4                 BL      sub_FF871280
ROM:FF8720B8                 CMN     R0, #1
ROM:FF8720BC                 BEQ     loc_FF87218C
ROM:FF8720C0                 LDR     R4, =0x37A4C
ROM:FF8720C4                 ADD     R1, R0, R0,LSL#2
ROM:FF8720C8                 LDR     R0, [R4,R1,LSL#2]
ROM:FF8720CC                 MOV     R3, #0
ROM:FF8720D0                 ADR     R2, sub_FF871988
ROM:FF8720D4                 ADD     R12, R4, R1,LSL#2
ROM:FF8720D8                 STR     R0, [R5,#0x58]   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
ROM:FF8720DC                 LDR     R1, [R12,#0xC]
ROM:FF8720E0                 STMEA   SP, {R1-R3}
ROM:FF8720E4                 LDR     R3, [R12,#8]
ROM:FF8720E8                 MOV     R2, #0
ROM:FF8720EC                 MOV     R1, #0
ROM:FF8720F0                 BL      _sub_FF918DA8__ImgDDev.c__6 ; LOCATION: ImgDDev.c:6
ROM:FF8720F4                 TST     R0, #1
ROM:FF8720F8                 LDRNE   R1, =0x6F4
ROM:FF8720FC                 LDRNE   R0, =aImageplayer_c ; "ImagePlayer.c"
*/

    return (void*)(*(int*) (0x2A70+0x58));       
}

As waterwingz said the code snippet is from the SX130 - looks like a function that was not converted during the port.

From what I can tell the equivalent function on the SX150 1.00a firmware is at address 0xFF8780C4.
The return statement should probably be:
    return (void*)(*(int*) (0x2BA8+0x58));

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)

Re: Powershot SX150 IS Porting Thread
« Reply #69 on: 11 / December / 2011, 10:10:24 »
Thanks waterwingz and philmoz.  You are right that some values were copied from the SX130is without change.
In addition to vid_get_viewport_fb_d() both hook_raw_image_addr() and vid_get_bitmap_fb() are probably wrong.

Edit: I thought recreview_hold was not working, but now am not sure.

philmoz' value for vid_get_viewport_fb_d() works.

Jon

« Last Edit: 11 / December / 2011, 13:28:29 by hiker_jon »

 

Related Topics