IXUS 1000 HS Porting Thread - page 11 - DryOS Development - CHDK Forum supplierdeeply

IXUS 1000 HS Porting Thread

  • 440 Replies
  • 166381 Views
*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #100 on: 04 / November / 2010, 17:26:40 »
Advertisements
I think this is the mask1 without the jogdial

Code: [Select]
#define KEYS_MASK1 (0x00075085)
and
Code: [Select]
#define KEYS_MASK0 (0x00000000)

Re: IXUS 1000 HS Porting Thread
« Reply #101 on: 04 / November / 2010, 17:48:47 »
thanks, i have now add all to keyb.c and have my log output in, but still no menu is show.

I dont understand wy all work in wrong way.key press is 0 and key not press is 1

kbd_is_key_pressed(conf.alt_mode_button) i have for test set to 4000 (right key press soft or press half)

The video key i cant use, because a test do always move out the lens and i want the camera for test in play mode to safe accu live

here is the keyb.c file i have now (with the LOG output).maybe you can see whats wrong.

http://www.zshare.net/download/82349994ce56e080/

« Last Edit: 04 / November / 2010, 17:53:04 by Bernd R »
Ixus 1000 HS

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #102 on: 05 / November / 2010, 02:19:22 »
we may have some numbers wrong

What I mean as the video record key on the back of the cam is that

0 -> 0
ef-> 0
418000 -> 0    Video

Is that what you mean with video?

aslo I think this is the right set

Code: [Select]
#define KEYS_MASK0 (0x00000000)
#define KEYS_MASK1 (0x00075085)  // needs to be added the feather bits
#define KEYS_MASK2 (0x00002002)


Code: [Select]
//Mask2 : 10000000000010  -> 2002

{ 2, KEY_SHOOT_FULL , 0x00002002 },  // ASM1989 testing ixus1000
{ 2, KEY_SHOOT_HALF , 0x00002000 },  // looks the same in ixus1000 needs to be tested



//Mask1 : 1110101000010000101  -> 75085

{ 1, KEY_UP     , 0x00002000 },  // ASM1989 testing ixus1000
{ 1, KEY_DOWN , 0x00080000 },  // ASM1989 testing ixus1000
{ 1, KEY_LEFT      , 0x00040000 },  // ASM1989 testing ixus1000
{ 1, KEY_RIGHT      , 0x00004000 },  // looks the same in ixus1000 needs to be tested
{ 1, KEY_SET      , 0x00001000 },  /// ASM1989 testing ixus1000
{ 1, KEY_ZOOM_IN         , 0x00000004 },  // looks the same in ixus1000 needs to be tested
{ 1, KEY_ZOOM_OUT        , 0x00000001 },  // looks the same in ixus1000 needs to be tested
{ 1, KEY_MENU      , 0x00010000 },  // ASM1989 testing ixus1000
{ 1, KEY_DISPLAY         , 0x00020000 },  // ASM1989 ixus2000 dosn't have one?
{ 1, KEY_PRINT      , 0x00000080 },  // ASM1989 testing ixus1000

ralyp or some one else I have a doubt on the set button,  it changes physw_status 1 and 2 , witch one should be take




Re: IXUS 1000 HS Porting Thread
« Reply #103 on: 05 / November / 2010, 05:41:12 »
>What I mean as the video record key on the back of the cam is that

>0 -> 0
>ef-> 0
>418000 -> 0    Video

Yes, i know, but this key seem not work, IXUS 300 build use key right +key down for alt.i think this is the reason that video key never work.

But i was happy when i can press the right key and menu pop up for now.later i can change

the chdk keyboard reader  do not add a time to the event structure, so a solution as double click on menu to get chdk menu is also not possible

>ralyp or some one else I have a doubt on the set button,  it changes physw_status 1 and 2 , witch one >should be take

sorry, the set button change only physw_status 1. i have forget to revert the value from USB cable plug.the values you add seem correct

>we may have some numbers wrong

yes some numbers are wrong, but i think there should at least 1 button work as KEY_PRINT so i can see the chdk menu.and later when this work, we can get the other working

Seem other cameras have no 2 key states, because chdk do not support that.so i think there need use the full press values.

you use for left /right/down /up the values for half press.this keys work in the ixus in same way as the shutter, when you press a little give a value and when press full give other value.same is for zoom too.what full press values are really correct, i cant verify until the chdk menu work.seem when do a full press, it happen that other keys press half too.

0 -> 0
406f-> 0
418000 -> 0     right soft press

0 -> 0
686f-> 0
418000 -> 0     right hard press


but for testing it is ok, but i dont understand wy the function

kbd_is_key_pressed return a 0 when the key is press.there is no compiler error.

when i change the kbd_is_key_pressed func so a key press return 1, then it work more.

but i see all functions work with the key values i post in that way, that when a key is not press, the funktion return a value.

same is here. this statement

  if ((kbd_new_state[keymap.grp] & keymap.canonkey) == 0)

do when for example kbd_new_state[keymap.grp] =0x4000 and keymap.canonkey = 0x4000(so its equal) this mathematic, my C knowledge is not good, but i verify with testcode.

      0x4000 and 0x4000 =0x4000.
but 0x4000 and 0x6f = 0

so when a key is press, the below func return 0.

thats strange and i dont understand


thats the next func that work diffrent

long kbd_get_pressed_key() {
    int i;
    for (i=0;keymap.hackkey;i++) {
        if ((kbd_new_state[keymap.grp] & keymap.canonkey) == 0) {
            return keymap.hackkey;
        }
    }
    return 0;
}


when i change this function in this way, so 1 is return when a key is press

#define LOG
long kbd_is_key_pressed(long key) {
    int i;
    for (i=0;keymap.hackkey;i++) {

        if (keymap.hackkey == key) {
#ifdef LOG
         static char osd_buf[64];
      int state =   ((kbd_new_state[keymap.grp] & keymap.canonkey) == 0) ? 1:0;
      sprintf(osd_buf, "Key %8x %8x %8x ",keymap.canonkey,kbd_new_state[keymap.grp], state);
      draw_txt_string(20, i, osd_buf, MAKE_COLOR(0xdd,0x6f));
#endif
       if (kbd_new_state[keymap.grp] & keymap.canonkey)return 1;else return 0;
            //return ((kbd_new_state[keymap.grp] & keymap.canonkey) == 0) ? 1:0;
        }
    }
    return 0;
}

then this log output in core/kybd.c is show.as long i press the key, key_pressed is increase to 0x2e and then stay on 0x2e

   if (key_pressed) {
#ifdef LOG
      sprintf(osd_buf, "alt key pressed     %8x ", key_pressed);
      draw_txt_string(20, 12, osd_buf, MAKE_COLOR(0xdd,0x6f));
#endif

see here of function i add above

long kbd_process()
{
/* Alternative keyboard mode stated/exited by pressing print key.
 * While running Alt. mode shoot key will start a script execution.
 */
 static char osd_buf[64];
    static int nCER=0;
// ------ modif by Masuji SUTO (start) --------------

    unsigned int mmode;
    unsigned int nCrzpos,i;
    unsigned int drmode = 0;

    if(conf.ricoh_ca1_mode && conf.remote_enable) {
        drmode = shooting_get_drive_mode();
        mmode = mode_get();
        mplay = (mmode&MODE_MASK)==MODE_PLAY;
//      mvideo= ((mmode&MODE_SHOOTING_MASK)==MODE_VIDEO_STD || (mmode&MODE_SHOOTING_MASK)==MODE_VIDEO_SPEED || (mmode&MODE_SHOOTING_MASK)==MODE_VIDEO_COMPACT ||(mmode&MODE_SHOOTING_MASK)==MODE_VIDEO_MY_COLORS || (mmode&MODE_SHOOTING_MASK)==MODE_VIDEO_COLOR_ACCENT);
        mvideo=MODE_IS_VIDEO(mmode);
    }
    // deals with alt-mode switch and delay emulation

    if (key_pressed) {
#ifdef LOG
      sprintf(osd_buf, "alt key pressed     %8x ", key_pressed);
      draw_txt_string(20, 12, osd_buf, MAKE_COLOR(0xdd,0x6f));
#endif

also below code is then execute


....
    if (kbd_is_key_pressed(conf.alt_mode_button)) {
#ifdef LOG
      sprintf(osd_buf, "alt key pressed       %8x ", key_pressed);
      draw_txt_string(20, 11, osd_buf, MAKE_COLOR(0xdd,0x6f));
#endif
        if (conf.ricoh_ca1_mode && conf.remote_enable)
            conf.synch_enable=1;
        key_pressed = 1;
        kbd_key_release_all();
        return 1;
    }

but still menu is not show.

thats really strange wy all the key stuff work in exchange way as the chdk expect on my Camera.
« Last Edit: 05 / November / 2010, 05:49:44 by Bernd R »
Ixus 1000 HS


Re: IXUS 1000 HS Porting Thread
« Reply #104 on: 05 / November / 2010, 06:10:55 »
>#define KEYS_MASK0 (0x00000000)
>#define KEYS_MASK1 (0x00075085)  // needs to be added the feather bits
>#define KEYS_MASK2 (0x00002002)

I have now compile with the new mask settings and original code.problem still the same.

I dont understand that, i see the code is in other camera the same and the camera work.only the ixus 1000 work diffrent and the code return 0 when a key is press.

i think the mask settings are not the problem, because when i look at this code, it seem the mask settings are only need, when the chdk menu is show and so kdb_process return diffrent as 0

if (kbd_process() == 0) {
        // we read keyboard state with _kbd_read_keys()

        jogdial_stopped=0;
    } else {
        // override keys
        physw_status[0] = (kbd_new_state[0] | KEYS_MASK0) & (~KEYS_MASK0 | kbd_mod_state[0]);
        physw_status[1] = (kbd_new_state[1] | KEYS_MASK1) & (~KEYS_MASK1 | kbd_mod_state[1]);
        physw_status[2] = (kbd_new_state[2] | KEYS_MASK2) & (~KEYS_MASK2 | kbd_mod_state[2]);

« Last Edit: 05 / November / 2010, 06:13:20 by Bernd R »
Ixus 1000 HS

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #105 on: 05 / November / 2010, 09:47:54 »
I will check the 0 in this function,

anyway, sd4000 does not have the print/record video button, and ixus1000 does have one, so we should be able to work it out.

what keys do work now and witch ones not?

if you can get into the menu you can enable debug
and start getting the values for zoom position, av steps
tv steps, modes, properties...
« Last Edit: 05 / November / 2010, 10:36:23 by asm1989 »

Re: IXUS 1000 HS Porting Thread
« Reply #106 on: 05 / November / 2010, 13:16:37 »
>what keys do work now and witch ones not?

correct values in source code have most keys i think, only left, right, top and down need the  correct full press values.

does the sx210/Ixus 300 or S95 have not halfpress/fullpress for the left right top  down /zoom buttons ?

on the ixus 1000 the full press is notice because there can hear a click.half press give no click and a weak press to button trigger the half press value.

on original firmware it work this way in shooting mode:

, when half press any side of the wheel(left right top down buttons are under the wheel)the action what do in menu is highlight.

only when you full press then you can activate.
But the Problem is, on fullpress its hard to avoid that you press the other buttons half, because half press a button need very few power.so you can get on fullpress 3 values.

I hope you understand what i mean.

i test now with a screewdriver to press the wheel right(right button) exact in the middle.

I get for [1]  0x8486F

now i press the button a little diffrent i get 0x8686F or 0x686f.so we need find out what the real hardpress bit is for right left up down.

I am sure other buttons are not full press, and btw i have small fingers.

EDIT:

but work do no key, because of the 0 return on press and 1 return on not press.

the code does not reach the check for alt key in this func it just bail out of

kbd_process()

because when a key is not press, it return 1.and so the function get tru, chdk think both keys are press and return

 if (kbd_is_key_pressed(KEY_SHOOT_HALF) && kbd_is_key_pressed(conf.alt_mode_button))
        return 0;
« Last Edit: 05 / November / 2010, 13:25:32 by Bernd R »
Ixus 1000 HS

Re: IXUS 1000 HS Porting Thread
« Reply #107 on: 05 / November / 2010, 17:09:04 »
Can somebody tell me what key output a camera bring on key release and key press ?. for example the right key

maybe other camera clear a bit on key Press.
but ixus 1000 set a bit on key press.

if thats really the diffrence i need all code in ixus 10000 kbd swap.
Ixus 1000 HS


*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #108 on: 06 / November / 2010, 04:35:16 »
@Bernd R

I think there is no problem at all with key release or keypress all the other cams have the same code,

regardig soft press- middle press and hard press of left,right,up and down is NOT implemented in chdk so you can not expect it to work, only work with shutter half and full presss

I your case the numbers i choose is the full press for left right up and down, like in other cams with this sensibilities

about keyb.c the main concerns is finding the correct numbers and mask for keys thats all , also since some of the jogdial code is implemented here, this may also be some problem, I will try to finish the jogdial code soon.

but if you have any wrong key code i wont work even for standar cam operation, so that why I ask you if you can use all the keys correctly,

any way I detect we have wrong the //kbd_prev_state[2]  becase in the ixus1000 it uses [1] and [2] and not 0 , so here you have my last keyb.c http://www.4shared.com/file/VqdPUozL/ixus100keybcv002.html

Here you have mor info on Keyboard:http://chdk.setepontos.com/index.php?topic=4290.msg40688#msg40688

« Last Edit: 06 / November / 2010, 05:21:51 by asm1989 »

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #109 on: 06 / November / 2010, 05:10:39 »
Kbd.c 101
Since the  kbd stuff is hard to get it, at least it was for me here is my quick tutorial

1.- Find all the values of physw_status 0 1 and 2

you can get it with on screen debug insertin this code

Code: [Select]
void my_kbd_read_keys()
{
static char osd_buf[64];

kbd_prev_state[0] = kbd_new_state[0];
kbd_prev_state[1] = kbd_new_state[1];
kbd_prev_state[2] = kbd_new_state[2];


sprintf(osd_buf, "1:       %8x  --> %8x", physw_status[0],kbd_new_state[0]);
draw_txt_string(20, 10, osd_buf, MAKE_COLOR(0xdd,0x6f));

sprintf(osd_buf, "2:       %8x  --> %8x", physw_status[1],kbd_new_state[1]);
draw_txt_string(20, 11, osd_buf, MAKE_COLOR(0xdd,0x6f));

sprintf(osd_buf, "3:       %8x  --> %8x", physw_status[2],kbd_new_state[2]);
draw_txt_string(20, 12, osd_buf, MAKE_COLOR(0xdd,0x6f));
msleep(500);

2.- This will get you serveral triads of hex values for each possible key in your cam, and very important the iddle values

for example in ixus 1000
Iddle was
physw_status[0]  -> 0
physw_status[1]  -> 6f
physw_status[2] -> 418000

3.- You need to see which of the 3 values change for each key , and calculate the keymap matchin each key with the iddle values

for example  ixus 1000 menu key was

physw_status[0] -> 0
physw_status[1] ->1006f
physw_status[2] ->418000

So the changing value was  physw_status[1],  now we will calculate its keymap

6f in binary is :                       1101111
1006f in binary is: 10000000001101111
So the keymap is: 10000000000000000  in hex: 10000

so its code is
Code: [Select]
{ 1, KEY_MENU     , 0x00010000 }1 because the physw that change was 1 not 0 or 2

4.- Follow this procedure with all the keys (that chdk support) and fill the keymap it's better to gruop them with the chaning physw number

in the ixus 1000 was:

Code: [Select]
static KeyMap keymap[] = {
        { 2, KEY_SHOOT_FULL , 0x00002002 },
{ 2, KEY_SHOOT_HALF , 0x00002000 },
{ 1, KEY_UP    , 0x00002000 },
{ 1, KEY_DOWN , 0x00080000 },
{ 1, KEY_LEFT     , 0x00040000 },  
{ 1, KEY_RIGHT     , 0x00004000 },  
{ 1, KEY_SET     , 0x00001000 },  
{ 1, KEY_ZOOM_IN         , 0x00000004 },  
{ 1, KEY_ZOOM_OUT        , 0x00000001 },  
{ 1, KEY_MENU     , 0x00010000 },
{ 1, KEY_DISPLAY         , 0x00020000 },  
{ 1, KEY_PRINT     , 0x00000080 },
     { 0, 0, 0 }
};
As you can see I put above the ones that change the 2 physw for easy of reading

5.- Now we need to calculate the mask, there are 3, one for each physw_status, but most cam usually use 2 of them only,
For example in the case of the ixus 1000 only 2 and 1:

Will get the mask for the keys that change physw_status[2]:
get the keymaps off all that keys, in this case only the shoot keys and OR them:
0x00002000  in binary: 10000000000000
0x00002002  in binary: 10000000000010
Result of ORing all is :   10000000000010  -> in hex :2002  

thats how we get
Code: [Select]
#define KEYS_MASK2 (0x00002002)  // physw_status[2]
Do the same for the physw and you get
Code: [Select]
#define KEYS_MASK0 (0x00000000)     // physw_status[0]
#define KEYS_MASK1 (0x00075085)     // physw_status[1]

6.- then at my_kbd_read_keys() comment the states  0  1  or 2 that its not used

in the ixus 1000
Code: [Select]
  //kbd_prev_state[0] = kbd_new_state[0]; // nothing to override
   .....
   //kbd_new_state[0] = physw_status[0];
   ....
   //    physw_status[0] = (kbd_new_state[0] | KEYS_MASK0) & (~KEYS_MASK0 | kbd_mod_state[0]);


7.- For the usb is the same as the keys but you put the values in diferent place

in the case of ixus1000 for example the value that change is 2, that mean the REG 3 and the mask is like any othe keymap but with its values
#define USB_MASK (0x80000)
#define USB_REG 3

8- This 101 on kbc must be completed with jogdial stuf


« Last Edit: 06 / November / 2010, 05:16:38 by asm1989 »

 

Related Topics