s80 anybody? - page 6 - General Discussion and Assistance - CHDK Forum supplierdeeply

s80 anybody?

  • 205 Replies
  • 94983 Views
Re: s80 anybody?
« Reply #50 on: 30 / October / 2009, 00:50:23 »
Advertisements
Finally I got the CHDK logo to show up on screen! This is what I've been trying to get done all night. Anyways, the link to the SD980 thread you sent me was very useful.

One issue is that there is obviously something causing the camera to crash after the initial screen is displayed. For example, if I put "debug_led(1); while(1);" at the end of gui_draw_splash() function, then I am able to see the CHDK logo, then the camera displays an image from the SD card. (I actually found it a bit odd that the camera continue to function despite the while(1) loop, but I guess that's just my lack of understanding of how CHDK works).

However, if I don't put the "debug_led(1); while(1);" line at the end of gui_draw_splash() , then the screen remains black and there is no logo. I will continue to investigate this tomorrow, but feel free to give me some advice.

Re: s80 anybody?
« Reply #51 on: 30 / October / 2009, 17:07:04 »
I have the feeling that if a task is going into infinite loop (say, because I put a while(1) somewhere in the task), then it will get killed after a few seconds. I think this explains why when I put a while(1) at the end of gui_handle_splash I can see the logo for like 2 seconds, but it doesn't appear to be flashing (looks like a stable image). And the logo disappears after 2 seconds because the spytask is killed or something. Is my guess correct?

Re: s80 anybody?
« Reply #52 on: 30 / October / 2009, 18:35:19 »
Ok, I finally figured it out (sort of). In an earlier message, I found it's odd I have to set
*((volatile int*) 0xc02200ac) = 0x46;
and
*((volatile int*) 0xc0220084) = 0x46;
in order to turn on the blue LED. I looked at some other camera ports, it seems 0xc0220084 is a fairly common address for the blue LED. It's not clear to me what 0xc02200ac corresponds to. I tried to do a search online and could not find much information. In any case, this time it turns out to be the same thing: I have to set 0xc02200ac to 0x46 in order to turn on the display. I did a search in the fw dump, and seems that address (0xc0000000 + 0x220000 + 0xac) appeared in one section of code linked from "TurnOnDisplay". The same code also appears in other camera dumps, but I don't know why s80 is behaving differently from other cameras. Anyways, now the CHDK logo loads properly and flashes. So I can proceed with the keyboard section now.

Re: s80 anybody?
« Reply #53 on: 30 / October / 2009, 19:46:45 »
Great work revivery, good to see progress being made!
I too would love to see the CHDK ported to the S80, it's an awesome camera & look forward to the day when I can shoot in RAW!


Re: s80 anybody?
« Reply #54 on: 31 / October / 2009, 20:45:06 »
I've figured out the code for most keys. Alt-mode is working, CHDK shows up now. remote-key not working yet. Here are some details;
=stubs_entry_2.S=

NHSTUB(platformsub_kbd_fetch_data, 0xFF82784C)
NHSTUB(kbd_read_keys_r2, 0xFF82737C)

=kbd.c=

#define KEYS_MASK0 (0x0000C000)   // state[0] mask
#define KEYS_MASK1 (0x3C3E0033) // state[1] mask
...
   { 1, KEY_UP      , 0x00040000 }, // ok
   { 1, KEY_DOWN      , 0x00100000 }, // ok
   { 1, KEY_LEFT      , 0x00020000 }, // ok
   { 1, KEY_RIGHT      , 0x00080000 }, // ok
   { 1, KEY_SET      , 0x00200000 }, // ok
   { 0, KEY_SHOOT_FULL   , 0x0000C000 }, // ok
   { 0, KEY_SHOOT_HALF   , 0x00004000 }, // ok
   { 1, KEY_ZOOM_IN   , 0x00000001 },
   { 1, KEY_ZOOM_OUT   , 0x00000002 },
   { 1, KEY_MENU      , 0x08000000 }, // ok
   { 1, KEY_DISPLAY   , 0x10000000 },
   { 1, KEY_PRINT      , 0x00000010 }, // ok
   { 1, KEY_ERASE      , 0x20000000 },
   { 1, KEY_EXPO_CORR   , 0x04000000 },


Re: s80 anybody?
« Reply #55 on: 31 / October / 2009, 22:07:42 »
I am looking at capt_seq.c, and it seems most part of it should come directly from the fw dump. Is this file supposed to be automatically generated from PRIMARY.BIN, or I should copy and paste from IDA?

*

Offline reyalp

  • ******
  • 14080
Re: s80 anybody?
« Reply #56 on: 31 / October / 2009, 22:29:57 »
I am looking at capt_seq.c, and it seems most part of it should come directly from the fw dump. Is this file supposed to be automatically generated from PRIMARY.BIN, or I should copy and paste from IDA?
The latter. You might want to look at asmify.sh in the tools directory, which can help you turn it into valid inline asm.
Don't forget what the H stands for.

Re: s80 anybody?
« Reply #57 on: 31 / October / 2009, 23:37:20 »
Ok, I finished capt_seq.c. The biggest problem now is that the camera reports 'Card Locked' when it turns on, and I cannot take any picture no matter how hard I press the shutter. The key code for the shutter should be correct because the camera does respond to the shutter in Alt-mode (it starts the default script). One possibility is that my SD_READONLY_FLAG is not set correctly, but it seems to be 0x20000 for all cameras I've looked at. What else could be causing the card lock?


*

Offline reyalp

  • ******
  • 14080
Re: s80 anybody?
« Reply #58 on: 01 / November / 2009, 00:16:57 »
Ok, I finished capt_seq.c. The biggest problem now is that the camera reports 'Card Locked' when it turns on, and I cannot take any picture no matter how hard I press the shutter. The key code for the shutter should be correct because the camera does respond to the shutter in Alt-mode (it starts the default script). One possibility is that my SD_READONLY_FLAG is not set correctly, but it seems to be 0x20000 for all cameras I've looked at. What else could be causing the card lock?
It must be the SD_READONLY flag, but it could be that you broke the code that uses it rather than the flag value itself. Or maybe your camera is different from the others. You should be able to see what bit it sets by watching the values of physw_status in misc debug vals (see gui.c gui_draw_debug_vals_osd()), and comparing what you see with a locked and unlocked card. You can start CHDK on an unlocked card by using the "firm update" method and the PS.FIR file.

The key code for the shutter doesn't matter, if you control the camera manually outside of altmode, the values shouldn't be changed.
Don't forget what the H stands for.

Re: s80 anybody?
« Reply #59 on: 01 / November / 2009, 00:29:12 »
Yes, I was hoping to get the SD_READONLY_FLAG by using a firmware update, but that option failed for me: after i do firmware update, the camera will simply stop responding. Any idea?

 

Related Topics