the sx20 porting thread - page 11 - General Discussion and Assistance - CHDK Forum

the sx20 porting thread

  • 1286 Replies
  • 493008 Views
*

Offline neszt

  • ***
  • 174
Re: the sx20 porting thread
« Reply #100 on: 23 / October / 2009, 08:21:51 »
Advertisements
You set a flag that tricks the camera into thinking it is unlocked. The lock is software only.
Well, nice. I searched a bit for it, but i'am not sure where to set this tricky flag?

I found some comments on older cameras, like

"AND  R3, R3, #0\n"    // - clear SD card R/O flag

I see, that WriteSDCard function is not autodetected. (Not exists in the stubs_entry.S)

I found it with help of your reference, and I added it to stubs_entry_2.S.

NHSTUB(WriteSDCard, 0xFF9409C4)

Are you sure, your WriteSDCard function address is correct?

*

Offline RaduP

  • *****
  • 926
Re: the sx20 porting thread
« Reply #101 on: 23 / October / 2009, 13:49:28 »
I think the address is correct, but the function does not work for me, it freezes the camera.
Anyway, the new stat function (that uses that structure) is here: NHSTUB(stat, 0xFF835560)
So try to find it on your camera.

In fact, here is my stubs 2

NHSTUB(AllocateUncacheableMemory, 0xFF8389D8)
NHSTUB(GetDrive_ClusterSize, 0xFF86BB04)
NHSTUB(GetDrive_TotalClusters, 0xFF86BB38)
NHSTUB(GetDrive_FreeClusters, 0xFF86BB64)
NHSTUB(SetPropertyCase, 0xFF888A44)
NHSTUB(kbd_read_keys, 0xFF8335A8)
NHSTUB(platformsub_kbd_fetch_data, 0xFF85AE80)
NHSTUB(kbd_read_keys_r2, 0xFF85A83C)
NHSTUB(qsort, 0xFF9FC560)


NHSTUB(TurnOffBackLight, 0xFF895660)//maybe
NHSTUB(vsprintf, 0xFF820350)
NHSTUB(VbattGet, 0xFF831E04)
NHSTUB(GetZoomLensCurrentPoint, 0xFF947174)//maybe
NHSTUB(GetZoomLensCurrentPosition, 0xFFA904E8)//maybe
NHSTUB(RefreshPhysicalScreen, 0xFF9F8694)
NHSTUB(ScreenLock, 0xFF9F9A44)
NHSTUB(EnterToCompensationEVF, 0xFF836AE0)
NHSTUB(ExitFromCompensationEVF, 0xFF825464)//maybe
NHSTUB(PT_PlaySound, 0xFF87D8A8)
NHSTUB(DoAFLock, 0xFF87481C)//maybe
NHSTUB(UnlockAF, 0xFF87482C)//maybe
NHSTUB(LEDDrive, 0xFF85A31C)//but could be FF85A320
NHSTUB(WriteSDCard, 0xFF933968)//probably the right address, but not working, freezes the camera
NHSTUB(PostLogicalEventForNotPowerType, 0xFF88E7B8)
NHSTUB(apex2us, 0xFF9FD42C)
NHSTUB(UnsetZoomForMovie, 0xFF97FDD8)

NHSTUB(PutInNdFilter, 0xFFA9C410)//string MoveIrisToFullOpen
NHSTUB(PutOutNdFilter,0xFFA9C3E8)//string MoveIrisToFullClose


// null sub - point these at nullsub_1 as labelled in IDA

NHSTUB(kbd_pwr_off, 0xFF810B04)
NHSTUB(kbd_pwr_on, 0xFF810B04)
NHSTUB(Mount_FileSystem, 0xFF810B04)
NHSTUB(Unmount_FileSystem, 0xFF810B04)
NHSTUB(SetZoomActuatorSpeedPercent, 0xFF810B04)
NHSTUB(rewinddir, 0xFF810B04)
NHSTUB(SetFileTimeStamp, 0xFF810B04)//would be nice if we could find this function

NHSTUB(UpdateMBROnFlash, 0xFF813F74)
NHSTUB(GetOpticalTemperature, 0xFF85E320)
NHSTUB(Open, 0xFF8353B0)
NHSTUB(Close, 0xFF835408)
NHSTUB(Write, 0xFF835498)
NHSTUB(lseek, 0xFF835524)
NHSTUB(mkdir, 0xFF83587C)
NHSTUB(malloc, 0xFF8140DC)
NHSTUB(free, 0xFF814138)
NHSTUB(strcmp, 0xFF8203A4)
NHSTUB(Remove, 0xFF83543C)
NHSTUB(opendir, 0xFFA7E0B0)
NHSTUB(closedir, 0xFFA7E06C)
NHSTUB(ReadFastDir, 0xFFA7E1E4)
NHSTUB(kbd_p2_f, 0xFF832ECC)
NHSTUB(strlen, 0xFF81400C)
NHSTUB(strcpy, 0xFF82038C)
NHSTUB(strcat, 0xFF8A5524)
NHSTUB(rename, 0xFF834D00)
NHSTUB(RenameFile_Fut, 0xFF834D00)
NHSTUB(strncpy, 0xFF813F38)
NHSTUB(strrchr, 0xFF813FE4)

NHSTUB(stat, 0xFF835560)

Some things changed since I posted the source.

*

Offline neszt

  • ***
  • 174
Re: the sx20 porting thread
« Reply #102 on: 25 / October / 2009, 07:36:59 »
Thanx! I found most of the remaining missing functions.

Now, i don't know where to go. I got spytask run, and i found the hook addresses, except the JogDial_task_my (what is even i don't know what) :)

When i hook the mykbd_task, i immediately lost the control of camera.

I see, things need to be corrected kbd.c like

static long alt_mode_key_mask = 0x00800000; // key_print
#define KEYS_MASK0 (0x00000003)
#define KEYS_MASK1 (0x0094FFE0)
#define KEYS_MASK2 (0x00000000)
#define NEW_SS (0x2000)
#define SD_READONLY_FLAG (0x20000)
#define USB_MASK (0x40000)
#define USB_REG 2

But i don't know how to find them out, and i don't know what else should to be corrected.

I think, i found the vid_get_bitmap_fb and vid_get_viewport_fb correctly also, so the CHDK splash logo should be appear. I can't decide if it appears, because i see horizontal orange line, probably some width variable is wrong somewhere..

*

Offline RaduP

  • *****
  • 926
Re: the sx20 porting thread
« Reply #103 on: 25 / October / 2009, 13:22:08 »
Well, try to get the screen to work, that's the first step, as you can't really get the keyboard working without the screen.
First, see if removing those things from camera.h helps.
#define CAM_USES_ASPECT_CORRECTION  1  //camera uses the modified graphics primitives to map screens an viewports to buffers more sized
#define CAM_USES_ASPECT_YCORRECTION  0  //only uses mappings on x coordinate

Then make sure you return the correct screen dimensions. If you are using the ones from the SD980, you are not returning the correct ones, because my screen is wider.
Once the screen works so that you can display stuff, you just follow the instructions on the porting guide to get the key masks and stuff going.

Re: the sx20 porting thread
« Reply #104 on: 25 / October / 2009, 18:16:54 »
I could help with testing, and some skills in Assembler, and very limited internet (umts) so sometimes a download to test

*

Offline neszt

  • ***
  • 174
Re: the sx20 porting thread
« Reply #105 on: 25 / October / 2009, 20:30:15 »
Then make sure you return the correct screen dimensions. If you are using the ones from the SD980, you are not returning the correct ones, because my screen is wider.
Please tell me, where can i correct the screen dimesions? In camera.h, or somewhere else?

My camera.h cloned from sx10, and looks like this, with some modified variables:

#elif defined (CAMERA_sx20)
    #define CAM_PROPSET                 2
    #define CAM_DRYOS                   1
    #define CAM_DRYOS_2_3_R39           1


    #define CAM_RAW_ROWPIX              4072
    #define CAM_RAW_ROWS                3036
   
    #define CAM_SWIVEL_SCREEN           1
    #define CAM_ADJUSTABLE_ALT_BUTTON   1
    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
    #define CAM_HAS_VIDEO_BUTTON       1
    #define CAM_VIDEO_QUALITY_ONLY          1 
    #define CAM_BRACKETING              1
    #undef  CAM_VIDEO_CONTROL
    #define CAM_MULTIPART               1
    #define CAM_HAS_JOGDIAL             1
    #undef  CAM_USE_ZOOM_FOR_MF
    #undef  CAM_UNCACHED_BIT  // shut up compiler
    #define CAM_UNCACHED_BIT    0x40000000


    #define DNG_SUPPORT                 1
    // pattern
    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
    // color

    #define CAM_COLORMATRIX1                               \
      827547, 1000000, -290458, 1000000, -126086, 1000000, \
     -12829,  1000000, 530507,  1000000, 50537,   1000000, \
      5181,   1000000, 48183,   1000000, 245014,  1000000

    #define cam_CalibrationIlluminant1 1 // Daylight
    // cropping
    #define CAM_JPEG_WIDTH  4000
    #define CAM_JPEG_HEIGHT 3000
    #define CAM_ACTIVE_AREA_X1 6
    #define CAM_ACTIVE_AREA_Y1 12
    #define CAM_ACTIVE_AREA_X2 3690
    #define CAM_ACTIVE_AREA_Y2 2772
    // camera name
    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
    #undef  CAM_SENSOR_BITS_PER_PIXEL
    #undef  CAM_WHITE_LEVEL
    #undef  CAM_BLACK_LEVEL
    #define CAM_SENSOR_BITS_PER_PIXEL   12
    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
    #define CAM_BLACK_LEVEL             127

    #define CAM_EXT_TV_RANGE            1

*

Offline neszt

  • ***
  • 174
Re: the sx20 porting thread
« Reply #106 on: 25 / October / 2009, 20:33:55 »
I could help with testing, and some skills in Assembler, and very limited internet (umts) so sometimes a download to test
There's nothing to be test yet, later on we hope. :)

What is your camera exact fimrware version?

*

Offline RaduP

  • *****
  • 926
Re: the sx20 porting thread
« Reply #107 on: 25 / October / 2009, 20:51:17 »
The dimensions are in lib.c /platform/camera/sub/version

*

Offline neszt

  • ***
  • 174
Re: the sx20 porting thread
« Reply #108 on: 26 / October / 2009, 07:30:24 »
The dimensions are in lib.c /platform/camera/sub/version
Ok, the dimensions are fixed. I see the CHDK boot screen!

Now, i hooked only the mykbd_task at 3 addresses: 0x1930, 0x1934, 0x1938. I saw blink only at 0x1938, but the keyboard didn't work in any cases.

Can I hook, only the mykbd_task, or need i hook some other at the same time?

Re: the sx20 porting thread
« Reply #109 on: 26 / October / 2009, 09:27:53 »
There's nothing to be test yet, later on we hope. :)

What is your camera exact fimrware version?

ver GM1.00f P-ID 31E4 pal
« Last Edit: 26 / October / 2009, 09:30:58 by Picaro »

 

Related Topics


SimplePortal © 2008-2014, SimplePortal