Amount of code in platform versions of kbd.c - General Discussion and Assistance - CHDK Forum supplierdeeply

Amount of code in platform versions of kbd.c

  • 8 Replies
  • 2917 Views
*

Offline zeno

  • *****
  • 889
Amount of code in platform versions of kbd.c
« on: 29 / March / 2008, 14:12:40 »
Advertisements
Can someone explain why there's so little code in some platform versions of kbd.c? For example, in a610, a620, a630, a640, a700, a710 there's well under 1k of code whereas for many other cameras (a560 and a570 for example) there's more than 7k of code.

The reason I ask is because I'm interested in adding Dial Mode support to cameras beyond the a570 (which is all I've done so far - see http://chdk.setepontos.com/index.php/topic,488.0.html) and the platform version of kbd.c is one of the files that needs modifying.
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Amount of code in platform versions of kbd.c
« Reply #1 on: 29 / March / 2008, 14:30:00 »
Because their code is the same and located in the platform/generic/kbd.c
CHDK Developer.

*

Offline zeno

  • *****
  • 889
Re: Amount of code in platform versions of kbd.c
« Reply #2 on: 30 / March / 2008, 07:33:31 »
Thanks Grand. I have much to learn!
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit

Re: Amount of code in platform versions of kbd.c
« Reply #3 on: 03 / October / 2009, 13:24:03 »
Sorry for digging this old topic up, but one question arises: so what is the proper way of porting kbd.c? Including platform/generic/kbd.c or copying existing kbd.c with all the functions from other port? If latter is preferred which kbd.c would you suggest?  I tried diffing different files but due to different formatting (for instance tabs vs space) it's hard to tell which one would be better (newer).
"Trying is the first step towards failure." (Homer Simpson)


*

Offline reyalp

  • ******
  • 13058
Re: Amount of code in platform versions of kbd.c
« Reply #4 on: 03 / October / 2009, 17:29:52 »
http://chdk.kernreaktor.org/mantis/view.php?id=313

I think most recent cameras are copies of other cameras, but in the long run it would be nice to have as much as possible in generic. So for now, do whatever is easiest for you.
Don't forget what the H stands for.

Re: Amount of code in platform versions of kbd.c
« Reply #5 on: 03 / October / 2009, 17:47:45 »
Thanks for your reply! I searched a bit longer and came to the conclusion that kbd.c from a2000/sx110is looks newer than in sx10/sx200is and I chose former.
"Trying is the first step towards failure." (Homer Simpson)

*

Offline reyalp

  • ******
  • 13058
Re: Amount of code in platform versions of kbd.c
« Reply #6 on: 03 / October / 2009, 17:50:06 »
Thanks for your reply! I searched a bit longer and came to the conclusion that kbd.c from a2000/sx110is looks newer than in sx10/sx200is and I chose former.
I'd suggest the reverse, sx10 is more likely to be correct IMO, and a2000/sx110 were probably based on this.
Don't forget what the H stands for.

Re: Amount of code in platform versions of kbd.c
« Reply #7 on: 04 / October / 2009, 10:30:49 »
OK, good to know. I tried using SX10' version but unfortunately it dies horribly :/

platformsub_kbd_fetch_data() changed almost completely. What is more, kbd_read_keys() in SX120IS uses now kbd_pwr_{on,off}() and SX10 does not (nullsubbed in stubs_entry_2.S). I presume that this may be a reason why A2000/SX110IS started using kbd_read_keys() instead of platformsub_kbd_fetch_data()...

It seams that I will need to stick to SX110' kbd.c for a while.
"Trying is the first step towards failure." (Homer Simpson)


*

Offline reyalp

  • ******
  • 13058
Re: Amount of code in platform versions of kbd.c
« Reply #8 on: 04 / October / 2009, 17:11:36 »
OK, good to know. I tried using SX10' version but unfortunately it dies horribly :/

platformsub_kbd_fetch_data() changed almost completely. What is more, kbd_read_keys() in SX120IS uses now kbd_pwr_{on,off}() and SX10 does not (nullsubbed in stubs_entry_2.S). I presume that this may be a reason why A2000/SX110IS started using kbd_read_keys() instead of platformsub_kbd_fetch_data()...

It seams that I will need to stick to SX110' kbd.c for a while.
Of course, if you find something that is more similar to your camera, use that :)
Don't forget what the H stands for.

 

Related Topics