open-src/xserver/xorg/sun-src/os/solaris/mdb/modules/Xserver_device_grabs.c
author Niveditha Rau <Niveditha.Rau@Oracle.COM>
Fri, 06 Apr 2012 21:57:14 -0700
changeset 1265 0b5cc5c013e4
parent 1192 60e4ec16e28d
permissions -rw-r--r--
7083537 Xorg 1.12 & associated module updates
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
     1
/*
1265
0b5cc5c013e4 7083537 Xorg 1.12 & associated module updates
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents: 1192
diff changeset
     2
 * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
     3
 *
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
     4
 * Permission is hereby granted, free of charge, to any person obtaining a
919
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
     5
 * copy of this software and associated documentation files (the "Software"),
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
     6
 * to deal in the Software without restriction, including without limitation
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
     7
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
     8
 * and/or sell copies of the Software, and to permit persons to whom the
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
     9
 * Software is furnished to do so, subject to the following conditions:
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    10
 *
919
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    11
 * The above copyright notice and this permission notice (including the next
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    12
 * paragraph) shall be included in all copies or substantial portions of the
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    13
 * Software.
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    14
 *
919
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    18
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    20
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 908
diff changeset
    21
 * DEALINGS IN THE SOFTWARE.
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    22
 */
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    23
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    24
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    25
#include <sys/mdb_modapi.h>
1192
60e4ec16e28d 7081442 Xorg mdb modules can't load
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 943
diff changeset
    26
60e4ec16e28d 7081442 Xorg mdb modules can't load
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 943
diff changeset
    27
#include "Xserver_mdb.h"
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    28
#include "xorg-server.h"
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    29
#include "inputstr.h"
1192
60e4ec16e28d 7081442 Xorg mdb modules can't load
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 943
diff changeset
    30
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    31
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    32
struct inputdev_walk_data {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    33
    InputInfo 		inputInfo;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    34
    DeviceIntRec	dev;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    35
};
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    36
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    37
/*
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    38
 * Initialize the inputdev walker by either using the given starting address,
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    39
 * or reading the value of the server's "inputInfo" pointer.  We also allocate
1192
60e4ec16e28d 7081442 Xorg mdb modules can't load
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 943
diff changeset
    40
 * a struct for storage, and save this using the walk_data pointer.
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    41
 */
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    42
_X_HIDDEN int
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    43
inputdev_walk_init(mdb_walk_state_t *wsp)
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    44
{
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    45
    uintptr_t inputInfoPtr;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    46
    struct inputdev_walk_data *iwda;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    47
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    48
    wsp->walk_data = mdb_alloc(sizeof (struct inputdev_walk_data), UM_SLEEP);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    49
    iwda = (struct inputdev_walk_data *) wsp->walk_data;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    50
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    51
    if (mdb_readsym(&(iwda->inputInfo), sizeof (InputInfo), "inputInfo") == -1)
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    52
    {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    53
	mdb_warn("failed to read inputInfo data", inputInfoPtr);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    54
	return (WALK_ERR);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    55
    }
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    56
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    57
    if (wsp->walk_addr == NULL) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    58
	wsp->walk_addr = (uintptr_t) iwda->inputInfo.devices;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    59
    }
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    60
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    61
    return (WALK_NEXT);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    62
}
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    63
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    64
/*
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    65
 * At each step, read a device struct into our private storage, and then invoke
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    66
 * the callback function.  We terminate when we reach the end of the inputdevs
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    67
 * array.
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    68
 */
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    69
_X_HIDDEN int
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    70
inputdev_walk_step(mdb_walk_state_t *wsp)
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    71
{
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    72
    int status;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    73
    uintptr_t inputdevPtr;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    74
    struct inputdev_walk_data *iwda
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    75
	= (struct inputdev_walk_data *) wsp->walk_data;
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    76
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    77
    if (wsp->walk_addr == NULL)
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    78
	return (WALK_DONE);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    79
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    80
    if (mdb_vread(&(iwda->dev), sizeof (DeviceIntRec), wsp->walk_addr) == -1) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    81
	mdb_warn("failed to read DeviceIntRec at %p", wsp->walk_addr);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    82
	return (WALK_DONE);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    83
    }
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    84
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    85
    status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    86
				wsp->walk_cbdata);
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    87
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    88
    wsp->walk_addr = (uintptr_t) iwda->dev.next;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    89
    return (status);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    90
}
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    91
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    92
/*
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    93
 * The walker's fini function is invoked at the end of each walk.  Since we
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    94
 * dynamically allocated data in client_walk_init, we must free it now.
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    95
 */
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    96
_X_HIDDEN void
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    97
inputdev_walk_fini(mdb_walk_state_t *wsp)
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    98
{
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    99
    mdb_free(wsp->walk_data, sizeof (struct inputdev_walk_data));
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   100
}
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   101
1265
0b5cc5c013e4 7083537 Xorg 1.12 & associated module updates
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents: 1192
diff changeset
   102
_X_HIDDEN void
0b5cc5c013e4 7083537 Xorg 1.12 & associated module updates
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents: 1192
diff changeset
   103
inputdev_grabs_help(void)
0b5cc5c013e4 7083537 Xorg 1.12 & associated module updates
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents: 1192
diff changeset
   104
{
0b5cc5c013e4 7083537 Xorg 1.12 & associated module updates
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents: 1192
diff changeset
   105
    mdb_printf(
0b5cc5c013e4 7083537 Xorg 1.12 & associated module updates
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents: 1192
diff changeset
   106
	"Prints information about a DeviceIntRec entry in the X server's list\n"
0b5cc5c013e4 7083537 Xorg 1.12 & associated module updates
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents: 1192
diff changeset
   107
	"of currently connected input devices.\n"
0b5cc5c013e4 7083537 Xorg 1.12 & associated module updates
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents: 1192
diff changeset
   108
	"\n"
0b5cc5c013e4 7083537 Xorg 1.12 & associated module updates
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents: 1192
diff changeset
   109
	"If no %<u>addr%</u> is specified, uses ::inputdev_walk to walk the linked list\n"
0b5cc5c013e4 7083537 Xorg 1.12 & associated module updates
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents: 1192
diff changeset
   110
	"of DeviceIntRec entries starting at the entry stored in the global\n"
0b5cc5c013e4 7083537 Xorg 1.12 & associated module updates
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents: 1192
diff changeset
   111
	"variable \"InputInfo\" and print information about each one.\n"
0b5cc5c013e4 7083537 Xorg 1.12 & associated module updates
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents: 1192
diff changeset
   112
	);
0b5cc5c013e4 7083537 Xorg 1.12 & associated module updates
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents: 1192
diff changeset
   113
}
0b5cc5c013e4 7083537 Xorg 1.12 & associated module updates
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents: 1192
diff changeset
   114
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
   115
_X_HIDDEN int
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   116
inputdev_grabs(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   117
{
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   118
    uintptr_t inputdevP;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   119
    DeviceIntPtr dev;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   120
    DeviceIntRec devRec;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   121
    const char *type;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   122
    char devName[32];
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   123
    InputInfo 		inputInfo;
851
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   124
    GrabPtr	grabP;
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
   125
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   126
    if (argc != 0)
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   127
	return (DCMD_USAGE);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   128
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   129
    /*
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   130
     * If no inputdev address was specified on the command line, we can
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   131
     * print out all inputdevs by invoking the walker, using this
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   132
     * dcmd itself as the callback.
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   133
     */
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   134
    if (!(flags & DCMD_ADDRSPEC)) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   135
	if (mdb_walk_dcmd("inputdev_walk", "inputdev_grabs",
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   136
			  argc, argv) == -1) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   137
	    mdb_warn("failed to walk 'inputdev_walk'");
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   138
	    return (DCMD_ERR);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   139
	}
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   140
	return (DCMD_OK);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   141
    }
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   142
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   143
    if (mdb_vread(&devRec, sizeof (DeviceIntRec), addr) == -1) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   144
	mdb_warn("failed to read DeviceIntRec at %p", addr);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   145
	return (WALK_DONE);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   146
    }
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
   147
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   148
    dev = &devRec;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   149
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   150
    if (mdb_readsym(&inputInfo, sizeof (InputInfo), "inputInfo") == -1)
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   151
    {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   152
	mdb_warn("failed to read inputInfo data");
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   153
	return (DCMD_ERR);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   154
    }
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
   155
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   156
    if (dev == inputInfo.keyboard) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   157
	type = "* core keyboard *";
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   158
    } else if (dev == inputInfo.pointer) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   159
	type = "* core pointer *";
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   160
    } else {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   161
	type = "";
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   162
    }
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   163
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   164
    if (mdb_readstr(devName, sizeof(devName), (uintptr_t) dev->name) == -1) {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   165
	mdb_warn("failed to read InputdevRec.name at %p", dev->name);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   166
	devName[0] = '\0';
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   167
    }
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
   168
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   169
    mdb_printf("Device \"%s\" id %d: %s\n", devName, dev->id, type);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   170
851
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   171
    grabP = dev->deviceGrab.grab;
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
   172
851
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   173
    if (grabP == NULL) {
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   174
	mdb_printf("  -- no active grab on device\n\n");
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   175
    } else {
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   176
	GrabRec grab;
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   177
851
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   178
	if (mdb_vread(&grab, sizeof (GrabRec), (uintptr_t) grabP) == -1) {
d428083dbbdd 6905171 X11R7.5 / Xorg 1.7.3 integration
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 492
diff changeset
   179
	    mdb_warn("failed to read GrabRec at %p", grabP);
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   180
	} else {
905
d2b59d5a79ed 6926932 Removal of Xsun on SPARC [PSARC 2008/033]: X consolidation portion
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 851
diff changeset
   181
	    int clientid = CLIENT_ID(grab.resource);
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   182
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   183
	    mdb_printf("  -- active grab %p by client %d\n\n", grab.resource,
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   184
		       clientid);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   185
	}
908
ee1047befc15 6928167 Integrate X server mdb module into xorg-server build & packages
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
   186
    }
492
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   187
    return (DCMD_OK);
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   188
}
abfa40ff15ef 6735204 Port Xsun mdb dcmds/scripts to Xorg and move to open-src tree
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   189