This file is indexed.

/usr/share/doc/libxnvctrl-dev/examples/nv-control-3dvisionpro.c is in libxnvctrl-dev 340.46-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
/*
 * Copyright (c) 2011 NVIDIA, Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/*
 * nv-control-3dvisionpro.c - Sample application that displays 
 * the details of the glasses currently attached to the transceiver
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include <X11/Xlib.h>

#include "NVCtrlLib.h"

int main(int argc, char* argv[])
{
    Display *dpy;
    Bool ret;
    int i, target_id = 0, glass_id, num_of_glasses = 0;
    unsigned int *ptr;
    char *glass_name;
    int len;    

    if(argc > 2) {
        printf("Too many Arguments\n");
        return(0);
    }

    if(argc != 1) {
        target_id = atoi(argv[1]);
    }
    
    /*
     * open a connection to the X server indicated by the DISPLAY
     * environment variable
     */

    dpy = XOpenDisplay(NULL);
    if (!dpy) {
        fprintf(stderr, "Cannot open display '%s'.\n", XDisplayName(NULL));
        return 1;
    }
    
    /*
     * query the ids of the glasses connected to the Transceiver 
     */    
    
    ret = XNVCTRLQueryTargetBinaryData(dpy, NV_CTRL_TARGET_TYPE_3D_VISION_PRO_TRANSCEIVER, target_id,
                                       0, NV_CTRL_BINARY_DATA_GLASSES_PAIRED_TO_3D_VISION_PRO_TRANSCEIVER,
                                       (unsigned char**) &ptr, &len);
    if (ret) {
        num_of_glasses = ptr[0];
        printf("Total no. of glasses paired = %d\n", num_of_glasses);
        
        if (num_of_glasses > 0) {
            printf("\n");
            printf("%-20s", "GlassId");
            printf("%-s\n", "GlassName" );
        }
        
        for (i = 0; i < num_of_glasses; i++) {
            glass_id = ptr[i+1];
            ret = XNVCTRLQueryTargetStringAttribute (dpy, NV_CTRL_TARGET_TYPE_3D_VISION_PRO_TRANSCEIVER, target_id,
                                                     glass_id, NV_CTRL_STRING_3D_VISION_PRO_GLASSES_NAME, &glass_name);
            if (ret) {
                printf("%-20d", glass_id);
                printf("%-s\n", glass_name);
            }
            else {
                printf("Error retrieving GlassName for Glassid %d\n", glass_id);
            }
            XFree(glass_name);
        }
        XFree(ptr);
    }

    /*
     * close the display connection
     */

    XCloseDisplay(dpy);
    
    return 0;
}