Once OpenVR returns correct hand data in supporting browsers, we can use hand property.
var isPresent = checkControllerPresentAndSetup(this.el.sceneEl, GAMEPAD_ID_PREFIX,
{ hand: data.hand });
Until then, use hardcoded index.
346298
function () {
    var data = this.data;
    var controllerIndex = data.hand === 'right' ? 0 : data.hand === 'left' ? 1 : 2;
    checkControllerPresentAndSetup(this, GAMEPAD_ID_PREFIX, {index: controllerIndex});
  }
101652
public boolean dispatchKeyEvent(KeyEvent event) {
        GVRCursorController controller = getUniqueControllerId(event.getDeviceId());
        if (controller != null) {
            return controller.dispatchKeyEvent(event);
        }
        return false;
    }
205770
function enterVRSuccess () {
          self.addState('vr-mode');
          self.emit('enter-vr', {target: self});
          // Lock to landscape orientation on mobile.
          if (self.isMobile && screen.orientation && screen.orientation.lock) {
            screen.orientation.lock('landscape');
          }
          self.addFullScreenStyles();

          // On mobile, the polyfill handles fullscreen.
          // TODO: 07/16 Chromium builds break when `requestFullscreen`ing on a canvas
          // that we are also `requestPresent`ing. Until then, don't fullscreen if headset
          // connected.
          if (!self.isMobile && !self.checkHeadsetConnected()) {
            requestFullscreen(self.canvas);
          }

          self.renderer.setAnimationLoop(self.render);
          self.resize();
        }
420701
function getGestureEventName (gesture, active) {
  var eventName;

  if (!gesture) { return; }

  eventName = EVENTS[gesture];
  if (eventName === 'grip') {
    return eventName + (active ? 'close' : 'open');
  }
  if (eventName === 'point' || eventName === 'thumb') {
    return eventName + (active ? 'up' : 'down');
  }
  if (eventName === 'pointing' || eventName === 'pistol') {
    return eventName + (active ? 'start' : 'end');
  }
  return;
}
539442
function(evt)
	{
		return (evt.pointerType != null) ? (evt.pointerType == 'touch' || evt.pointerType ===
			evt.MSPOINTER_TYPE_TOUCH) : ((evt.mozInputSource != null) ?
					evt.mozInputSource == 5 : evt.type.indexOf('touch') == 0);
	}
306579
function colorForTouch(touch) {
   var id = touch.identifier + (100 * Math.random());
  var r = Math.floor(id % 16);
  var g = Math.floor(id / 3) % 16;
  var b = Math.floor(id / 7) % 16;
  r = r.toString(16);
  g = g.toString(16);
  b = b.toString(16);
  var color = "#" + r + g + b;
  gamejs.logging.log(color)
  return color;
}
1053836
private int getCacheKey(InputDevice device, GVRControllerType controllerType) {
        if (controllerType != GVRControllerType.UNKNOWN &&
            controllerType != GVRControllerType.EXTERNAL) {
            // Sometimes a device shows up using two device ids
            // here we try to show both devices as one using the
            // product and vendor id

            int key = device.getVendorId();
            key = 31 * key + device.getProductId();
            key = 31 * key + controllerType.hashCode();

            return key;
        }
        return -1; // invalid key
    }
1298877
@Override
    @SuppressLint("NewApi")
    public boolean onTouch(View v, MotionEvent event) {
        if(touchable) {

            if (event.getAction() == MotionEvent.ACTION_DOWN) {
                view.setBackgroundColor(colorPressed);

                return true;
            }

            if (event.getAction() == MotionEvent.ACTION_CANCEL) {
                if (isSelected)
                    view.setBackgroundColor(colorSelected);
                else
                    view.setBackgroundColor(colorUnpressed);

                return true;
            }


            if (event.getAction() == MotionEvent.ACTION_UP) {

                view.setBackgroundColor(colorSelected);
                afterClick();

                return true;
            }
        }

        return false;
    }
1208987
public void makeTouchable(GVRSceneObject sceneObject, OnTouch handler) {
        if (handler != null) {
            if (sceneObject.getRenderData() != null) {
                if (!touchHandlers.containsKey(sceneObject)) {
                    makePickable(sceneObject);
                    touchHandlers.put(sceneObject, new WeakReference<>(handler));
                }
            } else if (sceneObject.getChildrenCount() > 0) {
                for (GVRSceneObject child : sceneObject.getChildren()) {
                    makeTouchable(child, handler);
                }
            }
        }
    }
432180
function (frameTime) {

        if (!this._standardGamepadAvailable) {
            return;
        }

        this._scanPressedGamepadButtons();
        this._scanInclinedGamepadAxes();

        // Update target depending on user input.

        var target = this.target;

        var position = this.target.position;
        var xAxis = target.localTransform.x.normalize();
        var zAxis = target.localTransform.z.normalize();

        var moveSpeed = this.moveSpeed * frameTime / 20;

        if (this._moveForward) {
            // Opposite direction of z.
            position.scaleAndAdd(zAxis, -moveSpeed);
        }
        if (this._moveBackward) {
            position.scaleAndAdd(zAxis, moveSpeed);
        }
        if (this._moveLeft) {
            position.scaleAndAdd(xAxis, -moveSpeed);
        }
        if (this._moveRight) {
            position.scaleAndAdd(xAxis, moveSpeed);
        }

        target.rotateAround(target.position, this.up, -this._offsetPitch * frameTime * Math.PI / 360);
        var xAxis = target.localTransform.x;
        target.rotateAround(target.position, xAxis, -this._offsetRoll * frameTime * Math.PI / 360);

        /*
         * If necessary: trigger `update` event.
         * XXX This can economize rendering OPs.
         */
        if (this._moveForward === true || this._moveBackward === true || this._moveLeft === true
            || this._moveRight === true || this._offsetPitch !== 0 || this._offsetRoll !== 0)
        {
            this.trigger('update');
        }

        // Reset values to avoid lost of control.

        this._moveForward = this._moveBackward = this._moveLeft = this._moveRight = false;
        this._offsetPitch = this._offsetRoll = 0;

    }
810171
function () {
    var gamepadSupportAvailable = navigator.getGamepads ||
        !!navigator.webkitGetGamepads ||
        !!navigator.webkitGamepads;

    if (!gamepadSupportAvailable) {
      // It doesn't seem Gamepad API is available, show a message telling
      // the visitor about it.
      window.tester.showNotSupported();
    } else {
      // Check and see if gamepadconnected/gamepaddisconnected is supported.
      // If so, listen for those events and don't start polling until a
      // gamepad has been connected.
      if (gamepadSupport.hasEvents) {
        // If connection events are not supported, just start polling.
        gamepadSupport.startPolling();
      } else {
        window.addEventListener('gamepadconnected',
                                gamepadSupport.onGamepadConnect);
        window.addEventListener('gamepaddisconnected',
                                gamepadSupport.onGamepadDisconnect);
      }
    }
  }
664357
function () {
    // Movement
    this.velocity = new THREE.Vector3(0, 0, 0);
    this.direction = new THREE.Vector3(0, 0, 0);

    // Rotation
    this.pitch = new THREE.Object3D();
    this.yaw = new THREE.Object3D();
    this.yaw.position.y = 10;
    this.yaw.add(this.pitch);

    // Button state
    this.buttons = {};

    if (!this.getGamepad()) {
      console.warn(
        'Gamepad #%d not found. Connect controller and press any button to continue.',
        this.data.controller
      );
    }
  }
1303227
function(evt) {
        evt.preventDefault();
        evt.stopPropagation();
        if (debug) { timedLog("endSecondFinger"); }
        if (evt.touches.length > 1) {
          if (debug) { timedLog("endSecondFinger - capped"); }
          return true;
        }
        if (debug) { timedLog("endSecondFinger - continued"); }
        handlers.startmark(evt);
        // If there are no fingers left on the screen,
        // we have not finished the handling
        return evt.touches.length !== 0;
      }
193053
function(event) {
    return (this._armed !== null &&
        event.type === 'mouseup' &&
        event.isTrusted &&
        event.button === 0 &&
        event.timeStamp - this._armed.t < 1000 &&
        Math.abs(event.clientX - this._armed.x) < 10 &&
        Math.abs(event.clientY - this._armed.Y) < 10);
  }
264255
function () {
        var gamepads = navigator.getGamepads();
        var e = {};

        // Trigger button bindings
        Object.keys(bindings).forEach(function (index) {
            var gamepad = gamepads[index];
            if (!gamepad) {
                return;
            }

            var mapping = null;
            if (gamepad.mapping !== "standard") {
                mapping = remap.get(gamepad.id);
            }

            var binding = bindings[index];

            // Iterate all buttons that have active bindings
            Object.keys(binding.buttons).forEach(function (button) {
                var last = binding.buttons[button];
                var mapped_button = button;
                var mapped_axis = -1;

                // Remap buttons if necessary
                if (mapping) {
                    mapped_button = mapping.buttons[button];
                    mapped_axis = mapping.analog[button];
                    if (mapped_button < 0 && mapped_axis < 0) {
                        // Button is not mapped
                        return;
                    }
                }

                // Get mapped button
                var current = gamepad.buttons[mapped_button] || {};

                // Remap an axis to an analog button
                if (mapping) {
                    if (mapped_axis >= 0) {
                        var value = mapping.normalize_fn(gamepad.axes[mapped_axis], -1, +button);

                        // Create a new object, because GamepadButton is read-only
                        current = {
                            "value" : value,
                            "pressed" : current.pressed || (Math.abs(value) >= deadzone)
                        };
                    }
                }

                me.event.publish(me.event.GAMEPAD_UPDATE, [ index, "buttons", +button, current ]);

                // Edge detection
                if (!last.pressed && current.pressed) {
                    api._keydown(e, last.keyCode, mapped_button + 256);
                }
                else if (last.pressed && !current.pressed) {
                    api._keyup(e, last.keyCode, mapped_button + 256);
                }

                // Update last button state
                last.value = current.value;
                last.pressed = current.pressed;
            });

            // Iterate all axes that have active bindings
            Object.keys(binding.axes).forEach(function (axis) {
                var last = binding.axes[axis];
                var mapped_axis = axis;

                // Remap buttons if necessary
                if (mapping) {
                    mapped_axis = mapping.axes[axis];
                    if (mapped_axis < 0) {
                        // axe is not mapped
                        return;
                    }
                }

                // retrieve the current value and normalize if necessary
                var value = gamepad.axes[mapped_axis];
                if (typeof(value) === "undefined") {
                    return;
                }
                if (mapping) {
                    value = mapping.normalize_fn(value, +axis, -1);
                }
                // normalize value into a [-1, 1] range value (treat 0 as positive)
                var range = Math.sign(value) || 1;
                if (last[range].keyCode === 0) {
                    return;
                }
                var pressed = (Math.abs(value) >= (deadzone + Math.abs(last[range].threshold)));

                me.event.publish(me.event.GAMEPAD_UPDATE, [ index, "axes", +axis, value ]);

                // Edge detection
                if (!last[range].pressed && pressed) {
                    // Release the opposite direction, if necessary
                    if (last[-range].pressed) {
                        api._keyup(e, last[-range].keyCode, mapped_axis + 256);
                        last[-range].value = 0;
                        last[-range].pressed = false;
                    }

                    api._keydown(e, last[range].keyCode, mapped_axis + 256);
                }
                else if ((last[range].pressed || last[-range].pressed) && !pressed) {
                    range = last[range].pressed ? range : -range;
                    api._keyup(e, last[range].keyCode, mapped_axis + 256);
                }

                // Update last axis state
                last[range].value = value;
                last[range].pressed = pressed;
            });
        });
    }
349586
function(event) {
    if (typeof event.touches != 'undefined' && event.touches.length > 0) {
      var c = {
        x: event.touches[0].pageX, 
        y: event.touches[0].pageY
      };
    } else {
      var  c = {
        x: (event.pageX || (event.clientX + document.body.scrollLeft)),
        y: (event.pageY || (event.clientY + document.body.scrollTop))
      };
    }
    
    return c;
  }
1093918
public boolean isControllerUp(int controller) {
		if (controller >= getControllerCount()) {
			return false;
		}

		if (controller == ANY_CONTROLLER) {
			for (int i=0;i<controllers.size();i++) {
				if (isControllerUp(i)) {
					return true;
				}
			}
			
			return false;
		}
		return ((Controller) controllers.get(controller)).getYAxisValue() < -0.5f
		   		|| ((Controller) controllers.get(controller)).getPovY() < -0.5f;
	}