1386N/A * Copyright © 2007 Daniel Stone
1386N/A * Copyright © 2007 Red Hat, Inc.
1386N/A+ * Copyright (c) 2013 Oracle
and/or its affiliates. All Rights Reserved.
1386N/A * Permission is hereby granted, free of charge, to any person obtaining a
1386N/A * copy of this software and associated documentation files (the "Software"),
1386N/A+#if ((defined(__sparc__) || defined(__sparc)) && defined(SUNSOFT))
1386N/A+DeviceIntPtr added_devices[MAX_DEVICES];
1386N/A+Bool abort_on_fail_over = FALSE;
1386N/A+static Bool do_abort = FALSE;
1386N/A+extern int num_total_disp_dev;
1386N/A+extern int num_session_disp_dev;
1386N/A+extern char disp_dev_path[PATH_MAX];
1386N/A+extern void GiveUp(int sig);
1386N/A@@ -124,6 +142,51 @@ get_prop_string_array(LibHalContext * hal_ctx, const char *udi,
1386N/A+#if (defined(__sparc__) || defined(__sparc))
1386N/A+Bool check_inactive_session(char const *path) {
1386N/A+ if ((num_session_disp_dev == num_total_disp_dev) || !disp_dev_path[0])
1386N/A+ if (lstat(path, &statbuf) == 0 &&
1386N/A+ readstatus = readlink(path, linkpath, sizeof(linkpath));
1386N/A+ if (readstatus > 0 && readstatus < sizeof(linkpath)) {
1386N/A+ if (strncmp(usbpath, "../..", sizeof("../..") - 1) == 0)
1386N/A+ usbpath += sizeof("../..") - 1;
1386N/A+ if (strncmp(usbpath, "/devices", sizeof("/devices") - 1) == 0)
1386N/A+ usbpath += sizeof("/devices") - 1;
1386N/A+ if (ptr = strchr(usbpath + 1, '/'))
1386N/A+ strncpy(disppath, disp_dev_path, sizeof(disppath));
1386N/A+ if (ptr = strchr(disppath + 1, '/'))
1386N/A+ return (strcmp(usbpath, disppath));
1386N/A add_extra_device(char *driver)
1386N/A@@ -178,6 +241,11 @@ device_added(LibHalContext * hal_ctx, const char *udi)
1386N/A struct xkb_options xkb_opts = { 0 };
1386N/A+#if ((defined(__sparc__) || defined(__sparc)) && defined(SUNSOFT))
1386N/A LibHalPropertySet *set = NULL;
1386N/A LibHalPropertySetIterator set_iter;
1386N/A char *psi_key = NULL, *tmp_val;
1386N/A@@ -264,6 +332,28 @@ device_added(LibHalContext * hal_ctx, const char *udi)
1386N/A input_options = input_option_new(input_options, "driver", driver);
1386N/A input_options = input_option_new(input_options, "name", name);
1386N/A+#if ((defined(__sparc__) || defined(__sparc)) && defined(SUNSOFT))
1386N/A+ if (!strcmp(name, "keyboard") || !strcmp(name, "mouse")) {
1386N/A+ if (check_inactive_session(path)) {
1386N/A+ /* M5: Input devices were removed, new input device added is to
1386N/A+ activate another session, reset it.
1386N/A+ /* M5: No removal of input devices happened, new input device
1386N/A+ added is to activate another session, do nothing.
1386N/A+ /* M5: new input device added is to activate current session. */
1386N/A+ abort_on_fail_over = FALSE;
1386N/A if (asprintf(&config_info, "hal:%s", udi) == -1) {
1386N/A@@ -428,7 +518,7 @@ device_added(LibHalContext * hal_ctx, const char *udi)
1386N/A InputOption *md = input_option_find(input_options, "mdriver");
1386N/A- char *mdriver = input_option_get_value(md);
1386N/A+ char *mdriver = (char *) input_option_get_value(md);
1386N/A add_extra_device (mdriver);
1386N/A@@ -442,6 +532,26 @@ device_added(LibHalContext * hal_ctx, const char *udi)
1386N/A+#if ((defined(__sparc__) || defined(__sparc)) && defined(SUNSOFT))
1386N/A+ if ((num_session_disp_dev < num_total_disp_dev) &&
1386N/A+ (!strcmp(name, "keyboard") || !strcmp(name, "mouse"))) {
1386N/A+ if (num_added_devices == MAX_DEVICES) {
1386N/A+ for (i = 0; i < MAX_DEVICES; i++) {
1386N/A+ if (added_devices[i] == 0) {
1386N/A libhal_free_property_set(set);
1386N/A@@ -474,6 +584,12 @@ device_added(LibHalContext * hal_ctx, const char *udi)
1386N/A+#if ((defined(__sparc__) || defined(__sparc)) && defined(SUNSOFT))
1386N/Aindex bee407b..248c603 100644
1386N/A * the sale, use or other dealings in this Software without prior written
1386N/A * authorization from the copyright holder(s) and author(s).
1386N/A+ * Copyright (c) 2013 Oracle
and/or its affiliates. All Rights Reserved.
1386N/A xf86InputDevicePostInit(DeviceIntPtr dev);
1386N/A+#if ((defined(__sparc__) || defined(__sparc)) && defined(sun))
1386N/A+extern int num_total_disp_dev;
1386N/A+extern int num_session_disp_dev;
1386N/A+extern DeviceIntPtr added_devices[MAX_DEVICES];
1386N/A+extern int num_added_devices;
1386N/A+extern Bool abort_on_fail_over;
1386N/A * Eval config and modify DeviceVelocityRec accordingly
1386N/A@@ -1432,6 +1444,25 @@ xf86DisableDevice(DeviceIntPtr dev, Bool panic)
1386N/A SendDevicePresenceEvent(dev->id, DeviceUnrecoverable);
1386N/A DeleteInputDeviceRequest(dev);
1386N/A+#if ((defined(__sparc__) || defined(__sparc)) && defined(sun))
1386N/A+ if (num_session_disp_dev < num_total_disp_dev) {
1386N/A+ for (i = 0; i < MAX_DEVICES; i++) {
1386N/A+ if (added_devices[i] == dev) {
1386N/A+ if (--num_added_devices == 0)
1386N/A+ /* M5: will abort server when another X session
1386N/A+ abort_on_fail_over = TRUE;
1386N/Aindex 258988a..2ec07d9 100644
1386N/A * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
1386N/A+ * Copyright (c) 2013 Oracle
and/or its affiliates. All Rights Reserved.
1386N/A * Permission is hereby granted, free of charge, to any person obtaining a
1386N/A * copy of this software and associated documentation files (the "Software"),
1386N/A+#if ((defined(__sparc__) || defined(__sparc)) && defined (sun))
1386N/A+int num_total_disp_dev = 0;
1386N/A+int num_session_disp_dev = 0;
1386N/A+char disp_dev_path[PATH_MAX];
1386N/A #define PCIINFOCLASSES(c) \
1386N/A ( (((c) & 0x00ff0000) == (PCI_CLASS_PREHISTORIC << 16)) \
1386N/A || (((c) & 0x00ff0000) == (PCI_CLASS_DISPLAY << 16)) \
1386N/A@@ -115,6 +122,11 @@ xf86PciProbe(void)
1386N/A+#if ((defined(__sparc__) || defined(__sparc)) && defined (sun))
1386N/A+ if (IS_VGA(info->device_class))
1386N/A@@ -483,6 +495,15 @@ xf86PciProbeDev(DriverPtr drvp)
1386N/A const struct pci_id_match *const devices = drvp->supported_devices;
1386N/A const unsigned numDevs = xf86MatchDevice(drvp->driverName, &devList);
1386N/A+#if ((defined(__sparc__) || defined(__sparc)) && defined (sun))
1386N/A+ struct sol_device_private {
1386N/A+ const char * device_string;
1386N/A+#define DEV_PATH(dev) (((struct sol_device_private *) dev)->device_string)
1386N/A+ num_session_disp_dev = numDevs;
1386N/A for (i = 0; i < numDevs; i++) {
1386N/A struct pci_device_iterator *iter;
1386N/A@@ -560,6 +581,11 @@ xf86PciProbeDev(DriverPtr drvp)
1386N/A if ((*drvp->PciProbe) (drvp, entry, pPci,
1386N/A+#if ((defined(__sparc__) || defined(__sparc)) && defined (sun))
1386N/A+ strncpy(disp_dev_path, DEV_PATH(pPci), sizeof(disp_dev_path));
1386N/A xf86UnclaimPciSlot(pPci, devList[i]);
1386N/A@@ -568,6 +594,7 @@ xf86PciProbeDev(DriverPtr drvp)