A470 Porting - page 26 - DryOS Development - CHDK Forum

A470 Porting

  • 253 Replies
  • 90426 Views
*

Offline srsa_4c

  • ******
  • 4451
Re: A470 Porting
« Reply #250 on: 28 / January / 2012, 22:44:36 »
Advertisements
Sorry for resurrecting this old thread, but it belongs to here.
Recently got one of these and was not pleased by the fact that it's missing a display button.
So I decided to use the power button instead. Only works in ALT mode, of course.
Patch against release 1.0

Code: [Select]
Index: platform/a470/kbd.c
===================================================================
--- platform/a470/kbd.c (revision 1614)
+++ platform/a470/kbd.c (working copy)
@@ -10,9 +10,9 @@
  long canonkey;
 } KeyMap;
 
-static long kbd_new_state[3];
-static long kbd_prev_state[3];
-static long kbd_mod_state[3];
+static long kbd_new_state[3] = {0xffffffff, 0xffffffff, 0xffffffff};
+static long kbd_prev_state[3] = {0xffffffff, 0xffffffff, 0xffffffff};
+static long kbd_mod_state[3] = {0xffffffff, 0xffffffff, 0xffffffff};
 static KeyMap keymap[];
 static long last_kbd_key = 0;
 static int usb_power=0;
@@ -21,8 +21,9 @@
 #define DELAY_TIMEOUT 10000
 
 #define KEYS_MASK0 (0x00000000)
-#define KEYS_MASK1 (0x00000000)
+#define KEYS_MASK1 (0x4000000)
 #define KEYS_MASK2 (0x153F)
+#define KEYS_INV1 (0x4000000)
 
 #define NEW_SS (0x2000)
 #define SD_READONLY_FLAG (0x20000)
@@ -161,6 +162,9 @@
 
  static void __attribute__((noinline)) mykbd_task_proceed()
 {
+    kbd_new_state[0] = physw_status[0];
+    kbd_new_state[1] = physw_status[1] ^ KEYS_INV1;
+    kbd_new_state[2] = physw_status[2];
     while (physw_run){
  _SleepTask(10);
 
@@ -231,19 +235,20 @@
     _kbd_pwr_on();
 
     kbd_fetch_data(kbd_new_state);
-
+    kbd_new_state[1] = kbd_new_state[1] ^ KEYS_INV1;
+   
     if (kbd_process() == 0){
  // leave it alone...
  physw_status[0] = kbd_new_state[0];
- physw_status[1] = kbd_new_state[1];
+ physw_status[1] = kbd_new_state[1] ^ KEYS_INV1;
  physw_status[2] = kbd_new_state[2];
     } else {
  // override keys
  physw_status[0] = (kbd_new_state[0] & (~KEYS_MASK0)) |
    (kbd_mod_state[0] & KEYS_MASK0);
 
- physw_status[1] = (kbd_new_state[1] & (~KEYS_MASK1)) |
-   (kbd_mod_state[1] & KEYS_MASK1);
+ physw_status[1] = ((kbd_new_state[1] & (~KEYS_MASK1)) |
+   (kbd_mod_state[1] & KEYS_MASK1)) ^ KEYS_INV1;
 
  physw_status[2] = (kbd_new_state[2] & (~KEYS_MASK2)) |
    (kbd_mod_state[2] & KEYS_MASK2);
@@ -432,6 +437,7 @@
     /* tiny bug: key order matters. see kbd_get_pressed_key()
      * for example
      */
+    /* additional key: ON/OFF: physw_status[1]: 0x4000000, inverted */
  { 2, KEY_UP , 0x00000001 }, //
  { 2, KEY_DOWN , 0x00000002 }, //
  { 2, KEY_LEFT , 0x00000008 }, //
@@ -442,6 +448,7 @@
  { 2, KEY_SHOOT_HALF , 0x00000010 }, 
  { 2, KEY_MENU , 0x00000400 },
  { 2, KEY_PRINT , 0x00001000 }, //
+ { 1, KEY_DISPLAY , 0x04000000 }, //on/off key, works only in ALT mode
  { 0, 0, 0 }
 };

Not for official inclusion (IMHO). I think some users would find it disturbing not being able to switch the camera off in ALT mode.

edit: Forgot to mention that this only makes sense when operating the camera by hand. From a script, pressing the fake "display" button would turn the camera off.



Update: several bugs have been fixed for the A470
http://chdk.setepontos.com/index.php?topic=650.msg80692#msg80692
« Last Edit: 30 / January / 2012, 21:17:25 by srsa_4c »

*

Offline reyalp

  • ******
  • 14126
Re: A470 Porting
« Reply #251 on: 31 / January / 2012, 00:38:36 »
I've updated the 100e and 101b builds to use the sig finder stubs_min.S values like 102c.
Trunk  changeset 1629 
stable changeset 1630

Given that srsa_4c verified the sig finder was correct on 102c, I'm pretty confident these are right, but if someone has either of these firmwares and can test the latest autobuild, that would be great. Affected variables relate to zoom status, movie recording status, and canon shoot menu (func menu) being open and recreview mode (holding shutter after shot)
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 4451
Re: A470 Porting
« Reply #252 on: 19 / January / 2013, 11:15:40 »
From now on, the ON/OFF button can be selected as replacement for the DISP button in ALT mode in CHDK 1.2 .

*

Offline reyalp

  • ******
  • 14126
Re: A470 Porting
« Reply #253 on: 05 / July / 2013, 16:54:57 »
As discussed in the PTP thread, the raw dimensions given this cameras platform.h did not match the raw size or the values found by the sig finder.

In trunk r2929 I've changed it to use the actual values, adding 6 rows to the raw size.

I don't know what the original motivation for this was. The change may mean that non-dng raw no longer loads in some programs.

Additionally, there was a comment on vid_get_viewport_live_fb (which returns 0) saying "Apparently deprecated". This is not correct. vid_get_viewport_live_fb is used for fast MD etc.
Don't forget what the H stands for.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal