Adding new cameras, applying patches into trunk (with source code prepared) - page 162 - General Discussion and Assistance - CHDK Forum

Adding new cameras, applying patches into trunk (with source code prepared)

  • 1612 Replies
  • 446513 Views
*

Online philmoz

  • *****
  • 3129
    • Photos
Advertisements
I wondered if stack size might be a concern, since the header is moderately large (36 bytes per buffer desc, plus 32 for header), but PTPSession seems to get a pretty generous size: 0x1000 on a540, 0x1800 on g7x and the stock PTP handlers are pretty complicated.


I considered that; but after testing it did not seem to be an issue.
It could be a static buffer; but I thought that was just wasting memory needlessly. Another option would be to malloc the buffer only once and not free it (or free it in the ptp code when the session is closed); but that was more complex. If it works on the A540 then it's probably safe to use the stack.


I missed a couple of initialisations when sections are not being sent - updated patch attached.
If you're happy with this I'll check it in.

CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)

*

Online reyalp

  • ******
  • 12156
I missed a couple of initialisations when sections are not being sent - updated patch attached.
If you're happy with this I'll check it in.
Seems fine to me.
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 4031
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #1612 on: 15 / November / 2019, 18:42:55 »
Spytask dereferences a NULL pointer during its startup.
gui_init() -> gui_set_mode() -> the gui_mode pointer is NULL initially

Does the following patch look good enough to fix this?
Code: [Select]
Index: core/gui.c
===================================================================
--- core/gui.c (revision 5293)
+++ core/gui.c (working copy)
@@ -2401,7 +2401,7 @@
 }
 
 //-------------------------------------------------------------------
-static gui_handler *gui_mode=0; // current gui mode. pointer to gui_handler structure
+static gui_handler *gui_mode = &altGuiHandler; // current gui mode. pointer to gui_handler structure
 
 static int gui_osd_need_restore = 0;    // Set when screen needs to be erase and redrawn
 static int gui_mode_need_redraw = 0;    // Set if current mode needs to redraw itself
I just pointed to one of the existing gui_handler instances, thought the pointer gets updated immediately anyway.

 

Related Topics