Added IOHIDSystem properties (this is about keyboard mapping)
Also added a ssize arg to mach trap args so that trap handler are aware of the sent packet size.
This commit is contained in:
parent
78fc8fd68f
commit
faba943220
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: darwin_iohidsystem.c,v 1.7 2003/05/22 22:07:38 manu Exp $ */
|
||||
/* $NetBSD: darwin_iohidsystem.c,v 1.8 2003/06/03 06:48:49 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: darwin_iohidsystem.c,v 1.7 2003/05/22 22:07:38 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: darwin_iohidsystem.c,v 1.8 2003/06/03 06:48:49 manu Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -66,10 +66,15 @@ static struct uvm_object *darwin_iohidsystem_shmem = NULL;
|
|||
static void darwin_iohidsystem_shmeminit(vaddr_t);
|
||||
static void darwin_iohidsystem_thread(void *);
|
||||
|
||||
#if 0
|
||||
static char darwin_iohidsystem_properties[] = "<dict ID=\"0\"><key>IOKit</key><string ID=\"1\">IOService</string><key>AccessMPC106PerformanceRegister</key><string ID=\"2\">AppleGracklePCI is not serializable</string><key>IONVRAM</key><reference IDREF=\"1\"/><key>IOiic0</key><string ID=\"3\">ApplePMU is not serializable</string><key>IORTC</key><reference IDREF=\"3\"/><key>IOBSD</key><reference IDREF=\"1\"/><key>setModemSound</key><string ID=\"4\">AppleScreamerAudio is not serializable</string><key>kdp</key><reference IDREF=\"1\"/></dict>";
|
||||
#endif
|
||||
static char darwin_iohidsystem_properties[] = "<dict ID=\"0\"><key>IOClass</key><string ID=\"1\">AppleADBKeyboard</string><key>ADBVirtualKeys</key><string ID=\"2\">0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,0x3B,0x37,0x38,0x39,0x3A,0x7B,0x7C,0x7D,0x7E,0x3F,0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x3C,0x3D,0x3E,0x36,0x7F</string><key>IOProbeScore</key><integer size=\"32\" ID=\"3\">0x3e8</integer><key>IOProviderClass</key><string ID=\"4\">IOADBDevice</string><key>CFBundleIdentifier</key><string ID=\"5\">com.apple.driver.AppleADBKeyboard</string><key>ADB Match</key><string ID=\"6\">2</string><key>PowerBook fn Foward Delete</key><integer size=\"64\" ID=\"7\">0x1</integer><key>IOMatchCategory</key><string ID=\"8\">IODefaultMatchCategory</string><key>HIDKeyMapping</key><data ID=\"10\">AAAIAAE5AQE4AgE7AwE6BAE3BRVSQUxTVFVFWFdWW1xDS1F7fX58TlkGAXIHAT9/DQBhAEEAAQABAMoAxwABAAENAHMAUwATABMA+wCnABMAEw0AZABEAAQABAFEAbYABAAEDQBmAEYABgAGAKYBrAAGAAYNAGgASAAIAAgA4wDrAAAYAA0AZwBHAAcABwDxAOEABwAHDQB6AFoAGgAaAM8BVwAaABoNAHgAWAAYABgBtAHOABgAGA0AYwBDAAMAAwHjAdMAAwADDQB2AFYAFgAWAdYB4AAWABYCADwAPg0AYgBCAAIAAgHlAfIAAgACDQBxAFEAEQARAPoA6gARABENAHcAVwAXABcByAHHABcAFw0AZQBFAAUABQDCAMUABQAFDQByAFIAEgASAeIB0gASABINAHkAWQAZABkApQHbABkAGQ0AdABUABQAFAHkAdQAFAAUCgAxACEBrQChDgAyAEAAMgAAALIAswAAAAAKADMAIwCjAboKADQAJACiAKgOADYAXgA2AB4AtgDDAB4AHgoANQAlAaUAvQoAPQArAbkBsQoAOQAoAKwAqwoANwAmAbABqw4ALQBfAB8AHwCxANAAHwAfCgA4ACoAtwC0CgAwACkArQC7DgBdAH0AHQAdACcAugAdAB0NAG8ATwAPAA8A+QDpAA8ADw0AdQBVABUAFQDIAM0AFQAVDgBbAHsAGwAbAGAAqgAbABsNAGkASQAJAAkAwQD1AAkACQ0AcABQABAAEAFwAVAAEAAQEAANAAMNAGwATAAMAAwA+ADoAAwADA0AagBKAAoACgDGAK4ACgAKCgAnACIAqQGuDQBrAEsACwALAM4ArwALAAsKADsAOgGyAaIOAFwAfAAcABwA4wDrABwAHAoALAA8AMsBowoALwA/AbgAvw0AbgBOAA4ADgDEAa8ADgAODQBtAE0ADQANAW0B2AANAA0KAC4APgC8AbMCAAkAGQwAIAAAAIAAAAoAYAB+AGABuwIAfwAI/wIAGwB+//////////////8AAC7/AAAq/wAAK/8AABv///8OAC8AXAAvABwALwBcAAAKAAAADf8AAC3//w4APQB8AD0AHAA9AHwAABhGAAAwAAAxAAAyAAAzAAA0AAA1AAA2AAA3/wAAOAAAOf///wD+JAD+JQD+JgD+IgD+JwD+KP8A/ir/AP4y/wD+M/8A/in/AP4r/wD+NP8A/i4A/jAA/i0A/iMA/i8A/iEA/jEA/iAAAawAAa4AAa8AAa0PAv8EADEC/wQAMgL/BAAzAv8EADQC/wQANQL/BAA2Av8EADcC/wQAOAL/BAA5Av8EADAC/wQALQL/BAA9Av8EAHAC/wQAXQL/BABbBgVyBn8HSgg+CT0KRw==</data><key>HIDKind</key><integer size=\"32\" ID=\"11\">0x1</integer><key>HIDInterfaceID</key><integer size=\"32\" ID=\"12\">0x2</integer><key>HIDSubinterfaceID</key><integer size=\"32\" ID=\"13\">0xc4</integer></dict>";
|
||||
|
||||
struct mach_iokit_devclass darwin_iohidsystem_devclass = {
|
||||
"<dict ID=\"0\"><key>IOProviderClass</key>"
|
||||
"<string ID=\"1\">IOHIDSystem</string></dict>",
|
||||
NULL,
|
||||
darwin_iohidsystem_properties,
|
||||
NULL,
|
||||
darwin_iohidsystem_connect_method_scalari_scalaro,
|
||||
NULL,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mach_iokit.c,v 1.19 2003/05/22 22:07:36 manu Exp $ */
|
||||
/* $NetBSD: mach_iokit.c,v 1.20 2003/06/03 06:48:47 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include "opt_compat_darwin.h"
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_iokit.c,v 1.19 2003/05/22 22:07:36 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_iokit.c,v 1.20 2003/06/03 06:48:47 manu Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -992,6 +992,8 @@ mach_io_registry_entry_from_path(args)
|
|||
struct lwp *l = args->l;
|
||||
struct mach_port *mp;
|
||||
struct mach_right *mr;
|
||||
struct mach_iokit_devclass *mid;
|
||||
int i, len;
|
||||
|
||||
#ifdef DEBUG_MACH
|
||||
printf("mach_io_registry_entry_from_path: path = %s\n", req->req_path);
|
||||
|
@ -1001,6 +1003,29 @@ mach_io_registry_entry_from_path(args)
|
|||
mp->mp_flags |= MACH_MP_INKERNEL;
|
||||
mr = mach_right_get(mp, l, MACH_PORT_TYPE_SEND, 0);
|
||||
|
||||
if (sizeof(*req) - 512 + req->req_pathcount > args->ssize) {
|
||||
#ifdef DEBUG_MACH
|
||||
printf("pathcount too big, truncating\n");
|
||||
#endif
|
||||
req->req_pathcount = args->ssize - (sizeof(*req) - 512);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while ((mid = mach_iokit_devclasses[i++]) != NULL) {
|
||||
len = strlen(mid->mid_name);
|
||||
#ifdef DEBUG_MACH
|
||||
printf("trying \"%s\" vs \"%s\"\n",
|
||||
&req->req_path[req->req_pathcount - 1 - len],
|
||||
mid->mid_name);
|
||||
#endif
|
||||
if (memcmp(&req->req_path[req->req_pathcount - 1 - len],
|
||||
mid->mid_name, len) == 0) {
|
||||
mp->mp_datatype = MACH_MP_IOKIT_DEVCLASS;
|
||||
mp->mp_data = mid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
rep->rep_msgh.msgh_bits =
|
||||
MACH_MSGH_REPLY_LOCAL_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE) |
|
||||
MACH_MSGH_BITS_COMPLEX;
|
||||
|
@ -1015,3 +1040,38 @@ mach_io_registry_entry_from_path(args)
|
|||
*msglen = sizeof(*rep);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
mach_io_registry_entry_get_parent_iterator(args)
|
||||
struct mach_trap_args *args;
|
||||
{
|
||||
mach_io_registry_entry_get_parent_iterator_request_t *req = args->smsg;
|
||||
mach_io_registry_entry_get_parent_iterator_reply_t *rep = args->rmsg;
|
||||
size_t *msglen = args->rsize;
|
||||
struct lwp *l = args->l;
|
||||
struct mach_port *mp;
|
||||
struct mach_right *mr;
|
||||
|
||||
#ifdef DEBUG_MACH
|
||||
printf("mach_io_registry_entry_get_parent_iterator: plane = %s\n",
|
||||
req->req_plane);
|
||||
#endif
|
||||
|
||||
mp = mach_port_get();
|
||||
mp->mp_flags |= MACH_MP_INKERNEL;
|
||||
mr = mach_right_get(mp, l, MACH_PORT_TYPE_SEND, 0);
|
||||
|
||||
rep->rep_msgh.msgh_bits =
|
||||
MACH_MSGH_REPLY_LOCAL_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE) |
|
||||
MACH_MSGH_BITS_COMPLEX;
|
||||
rep->rep_msgh.msgh_size = sizeof(*rep) - sizeof(rep->rep_trailer);
|
||||
rep->rep_msgh.msgh_local_port = req->req_msgh.msgh_local_port;
|
||||
rep->rep_msgh.msgh_id = req->req_msgh.msgh_id + 100;
|
||||
rep->rep_body.msgh_descriptor_count = 1;
|
||||
rep->rep_iterator.name = (mach_port_t)mr->mr_name;
|
||||
rep->rep_iterator.disposition = 0x11; /* XXX */
|
||||
rep->rep_trailer.msgh_trailer_size = 8;
|
||||
|
||||
*msglen = sizeof(*rep);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mach_iokit.h,v 1.16 2003/05/22 22:07:37 manu Exp $ */
|
||||
/* $NetBSD: mach_iokit.h,v 1.17 2003/06/03 06:48:47 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -496,6 +496,23 @@ typedef struct {
|
|||
mach_msg_trailer_t rep_trailer;
|
||||
} mach_io_registry_entry_from_path_reply_t;
|
||||
|
||||
/* io_registry_entry_get_parent_iterator */
|
||||
|
||||
typedef struct {
|
||||
mach_msg_header_t req_msgh;
|
||||
mach_ndr_record_t req_ndr;
|
||||
mach_msg_type_number_t req_offset;
|
||||
mach_msg_type_number_t req_count;
|
||||
char req_plane[128];
|
||||
} mach_io_registry_entry_get_parent_iterator_request_t;
|
||||
|
||||
typedef struct {
|
||||
mach_msg_header_t rep_msgh;
|
||||
mach_msg_body_t rep_body;
|
||||
mach_msg_port_descriptor_t rep_iterator;
|
||||
mach_msg_trailer_t rep_trailer;
|
||||
} mach_io_registry_entry_get_parent_iterator_reply_t;
|
||||
|
||||
int mach_io_service_get_matching_services(struct mach_trap_args *);
|
||||
int mach_io_iterator_next(struct mach_trap_args *);
|
||||
int mach_io_service_open(struct mach_trap_args *);
|
||||
|
@ -522,6 +539,7 @@ int mach_io_service_close(struct mach_trap_args *);
|
|||
int mach_io_connect_add_client(struct mach_trap_args *);
|
||||
int mach_io_connect_method_scalari_structi(struct mach_trap_args *);
|
||||
int mach_io_registry_entry_from_path(struct mach_trap_args *);
|
||||
int mach_io_registry_entry_get_parent_iterator(struct mach_trap_args *);
|
||||
|
||||
extern struct mach_iokit_devclass *mach_iokit_devclasses[];
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mach_message.c,v 1.24 2003/02/05 23:58:10 manu Exp $ */
|
||||
/* $NetBSD: mach_message.c,v 1.25 2003/06/03 06:48:48 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002-2003 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_message.c,v 1.24 2003/02/05 23:58:10 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_message.c,v 1.25 2003/06/03 06:48:48 manu Exp $");
|
||||
|
||||
#include "opt_ktrace.h"
|
||||
#include "opt_compat_mach.h" /* For COMPAT_MACH in <sys/ktrace.h> */
|
||||
|
@ -228,6 +228,7 @@ mach_sys_msg_overwrite_trap(l, v, retval)
|
|||
args.smsg = sm;
|
||||
args.rmsg = rm;
|
||||
args.rsize = &rcv_size;
|
||||
args.ssize = send_size;
|
||||
if ((*retval = (*map->map_handler)(&args)) != 0)
|
||||
goto out1;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mach_message.h,v 1.15 2003/03/03 22:07:39 manu Exp $ */
|
||||
/* $NetBSD: mach_message.h,v 1.16 2003/06/03 06:48:48 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001-2003 The NetBSD Foundation, Inc.
|
||||
|
@ -214,6 +214,7 @@ struct mach_trap_args {
|
|||
struct lwp *l;
|
||||
void *smsg;
|
||||
void *rmsg;
|
||||
size_t ssize;
|
||||
size_t *rsize;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mach_namemap.c,v 1.29 2003/05/22 22:07:37 manu Exp $ */
|
||||
/* $NetBSD: mach_namemap.c,v 1.30 2003/06/03 06:48:48 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002-2003 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_namemap.c,v 1.29 2003/05/22 22:07:37 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_namemap.c,v 1.30 2003/06/03 06:48:48 manu Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -81,6 +81,8 @@ struct mach_subsystem_namemap mach_namemap[] = {
|
|||
"io_registry_entry_get_properties" },
|
||||
{ 2813, mach_io_registry_entry_get_child_iterator,
|
||||
"io_registry_entry_get_child_iterator" },
|
||||
{ 2814, mach_io_registry_entry_get_parent_iterator,
|
||||
"io_registry_entry_get_parent_iterator" },
|
||||
{ 2815, mach_io_service_open, "io_service_open" },
|
||||
{ 2816, mach_io_service_close, "io_service_close" },
|
||||
{ 2817, mach_io_connect_get_service, "io_connect_get_service" },
|
||||
|
|
Loading…
Reference in New Issue