How do I check if a SteamVR HMD and controllers are active?

I try to check for an active SteamVR HMD to activate a certain locomotion script. Also I need to check for active controllers.

I tried something along this code:

  if ( SteamVR.active)
    {
        Debug.Log("SteamVR is active");
        // use VR controllers;

        if (Input.GetJoystickNames()[0] = !null)
            Debug.Log("Right Controller is active");

        if (Input.GetJoystickNames()[1] = !null)
            Debug.Log("Left Controller is active");

    }

    else
    // use standard first person controller;

But it did not work… any ideas?