I've extracted the
wait_until_remote_button_is_released() from every platform/kbd.c file.
With a little perl scripting and some keyboarding, I compared each by deleting whitespace, comments and formatting. The code seems to break down into four groups - each group implementing slightly different logic from the rest. There are also small differences between most files that I've documented but ignored - unused
long x[3]; in many files, the use of
debug_led(); for example.
= Group 1 ======= reference G7 ======================================
a430 a450 a460 a470 a490 a495 a590 a550 a560 a570
a580 a650 a720 a3000 d10 g7 g9 g11 ixus100_sd780
ixus70_sd1000 ixus90_sd790 ixus970_sd890 ixus850_sd800
ixus1000_sd4500 ixus300_sd4000 ixus900_sd900 ixus860_sd870
ixus85_sd770 ixus95_sd1200 ixus980_sd990 s90 s95 sx130is
sx220hs sx230hs tx1*
* uses ((usb_physw[2] & USB_MASK)==USB_MASK) vs (usb_physw[2]&USB_MASK)
= Group 2 ===== missing (shooting_get_drive_mode()==1) =================
ixus120_sd940 ixus870_sd880 ixus950_sd850 ixus960_sd950
a2000 ixus200_sd980 ixus310_elph500hs s5is sx10 sx1
sx200is sx20 g12 sx30 g10 ixus870_sd880 sx110is
a1100** a480**
** adds calls to _platformsub_kbd_fetch_data(x);
= Group 3 ===== comments out all code - just pushes & pops ==============
s2is s3is
= Group 4 === old cameras using x=get_mmio() ================================
generic (includes a410 a530 a540 a610 a620 a630
a640 a700 a710 ixus800_sd700)
ixus55_sd450_kbd
Ignoring group 3 & 4 for now, the code in groups 1 & 2 both have sections that can never be executed. Group one has one zombie section while group 2 has two. This needs to be fixed as part of this USB Remote Switch cleanup effort.
Here's the reference code (cut from the G7 but common to all)
1 if ( conf.synch_enable
2 && conf.ricoh_ca1_mode
3 && conf.remote_enable
4 && ( !shooting_get_drive_mode()
5 || (shooting_get_drive_mode()==1)
6 || ( (shooting_get_drive_mode()==2)
7 && state_shooting_progress != SHOOTING_PROGRESS_PROCESSING ) ))
8 {
9 nMode=0; usb_physw[2] = 0; _kbd_read_keys_r2(usb_physw);
10 if((usb_physw[2] & USB_MASK)==USB_MASK) nMode=1;
11
12 if( conf.ricoh_ca1_mode && conf.remote_enable )
13 {
14 if(shooting_get_drive_mode()==1 && state_shooting_progress == SHOOTING_PROGRESS_PROCESSING)
15 {
Notice that it the conditional on line 12 will always evaluate at TRUE due to lines 2 & 3 needing to be true before line 12 can be reached. The "else" condition of line 12 is never executed.
In addition, group 2 camera do not have line 5 and so line 14 can never evaluate as TRUE.
Next Steps in Clean-up Plan- Reach consensis on how this logic is supposed to work.
- Decide if we want debug_led() code embedded (tells user that camera is waiting for shooting to complete but interfers with other debug_led() usage)
- Delete unused long x[3] from all version ( easy decision ).
- Do we then put the resulting two versions of wait_until_remote_button_is_released() in generic.c (old cameras version and new camera version) and delete from all platform/kbd.c files ?
Sorry for another tl;dr post - hard to get this info out in a shorter format.