ottokiksmaler / gear360_modding

Repository for Samsung Gear 360 (2017) modding
59 stars 12 forks source link

Adding secondary trigger #17

Open amougel opened 5 months ago

amougel commented 5 months ago

https://github.com/ottokiksmaler/gear360_modding/blob/0e3af0fcc019737808cd2ec2bdd2e2df14ee42dd/keyscan360.c#L239

Hi! @ottokiksmaler

(First of all, thanks again for sharing these settings, much appreciated)

My Project

I wanted to share a version of keyscan360 with a secondary trigger this way:

Based on the fact that I didn't want to change your code too much, I kept your logic that previous_ev is registered based on the last PRESSED and also the fact that I didn't know what REPEATED actually meant, I didn't want to risque redoing the logic with PRESSED and RELEASED by hand.

I ended up implementing this trigger:

  if (NXKEY_EV1 != (int)ev.code && msec_elapsed < 1000 && ev.code != previous_ev.code && (int)ev.code == 127 && (int)previous_ev.code == 73 && ev.value == previous_ev.value) {
                  debug && printf("Mixclick %s %d\n", nxkeyname[(int)ev.code], (int)ev.code);
                  strncpy(shell_name,nxkeyname[(int)ev.code],8);
                  strncat(shell_name,"_",8);
                  strncat(shell_name,nxkeyname[(int)ev.code],8);
                  call_shell=1;
              }

Then I encountered this fascinating behavior which tells me I'm clearly not understanding how the device works:

Scenario 1 (Using ISO settings):

  1. Power up the camera
  2. Blue light above the Power button light up for a second
  3. I press POWER then quickly MENU
  4. My LEDs are correctly blinking indicating it went inside G360POWE_G360MEN.sh
  5. I take pictures
  6. I open the pictures on my PC: The ISO setting is clear correctly set

Scenario 2 (Using remote access):

  1. Power up the camera
  2. Blue light above the Power button light up for a second
  3. I press POWER then quickly POWER again
  4. The LEDs are correctly blinking indicating it went inside G360POWE_G360POW.sh
  5. I open the browser on my phone, I can access the data on device and run commands.

Scenario 3 (Using remote access THEN ISO):

  1. Power up the camera
  2. Blue light above the Power button light up for a second
  3. I press POWER then quickly POWER again
  4. The LEDs are correctly blinking indicating it went inside G360POWE_G360POW.sh
  5. I press POWER then MENU
  6. The LEDs are correctly blinking indicating it went inside G360POWE_G360POW.sh ?
  7. I press again and again, always the same LEDs

Scenario 4 (Using ISO then remote access):

  1. Power up the camera
  2. Blue light above the Power button light up for a second
  3. I press POWER then quickly MENU
  4. My LEDs are correctly blinking indicating it went inside G360POWE_G360MEN.sh
  5. I press POWER then quickly POWER again
  6. The LEDs keep blinking with MY version indicating it went inside G360POWE_G360MEN.sh?
  7. I press again and again, always the same LEDs

Question:

It seems I can only run one single script, but I can however run it several times? It makes no sense. Reading keyscan360, the variables

shell_script[0]='\0';
shell_name[0]='\0';
call_shell=0;

are correctly reinitialized after each shell script call, so I don't understand why it's always redirecting to the same script once one has been triggered.

Do you have an idea?