
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1224692656 25200 # Node ID e53b108e82fc54142208dd48a6edd07c2eae0a68 # Parent 739113a661c7a342e67bd7f19ce8c744e283bbff Add PointingDevice schema and input device type. PointingDevice will represent the input device. Using resource type 13 ("I/O Device") as the device type. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 739113a661c7 -r e53b108e82fc Makefile.am --- a/Makefile.am Mon Oct 20 18:24:30 2008 -0700 +++ b/Makefile.am Wed Oct 22 09:24:16 2008 -0700 @@ -47,7 +47,8 @@ schema/ConsoleRedirectionServiceCapabilities.mof \ schema/ServiceAffectsElement.mof \ schema/KVMRedirectionSAP.mof \ - schema/DisplayController.mof + schema/DisplayController.mof \ + schema/PointingDevice.mof INTEROP_MOFS = \ schema/ComputerSystem.mof \ @@ -105,7 +106,8 @@ schema/ConsoleRedirectionServiceCapabilities.registration \ schema/ServiceAffectsElement.registration \ schema/KVMRedirectionSAP.registration \ - schema/DisplayController.registration + schema/DisplayController.registration \ + schema/PointingDevice.registration INTEROP_REGS = \ schema/RegisteredProfile.registration \ diff -r 739113a661c7 -r e53b108e82fc schema/PointingDevice.mof --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/PointingDevice.mof Wed Oct 22 09:24:16 2008 -0700 @@ -0,0 +1,17 @@ +// Copyright IBM Corp. 2007 + +[ Provider("cmpi::Virt_Device") ] +class Xen_PointingDevice : CIM_PointingDevice +{ +}; + +[ Provider("cmpi::Virt_Device") ] +class KVM_PointingDevice : CIM_PointingDevice +{ +}; + +[ Provider("cmpi::Virt_Device") ] +class LXC_PointingDevice : CIM_PointingDevice +{ +}; + diff -r 739113a661c7 -r e53b108e82fc schema/PointingDevice.registration --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/PointingDevice.registration Wed Oct 22 09:24:16 2008 -0700 @@ -0,0 +1,5 @@ +# Copyright IBM Corp. 2008 +# Classname Namespace ProviderName ProviderModule ProviderTypes +Xen_PointingDevice root/virt Virt_Device Virt_Device instance +KVM_PointingDevice root/virt Virt_Device Virt_Device instance +LXC_PointingDevice root/virt Virt_Device Virt_Device instance diff -r 739113a661c7 -r e53b108e82fc src/svpc_types.h --- a/src/svpc_types.h Mon Oct 20 18:24:30 2008 -0700 +++ b/src/svpc_types.h Wed Oct 22 09:24:16 2008 -0700 @@ -29,15 +29,17 @@ #define CIM_RES_TYPE_DISK 17 #define CIM_RES_TYPE_EMU 1 #define CIM_RES_TYPE_GRAPHICS 24 +#define CIM_RES_TYPE_INPUT 13 #define CIM_RES_TYPE_UNKNOWN 1000 -#define CIM_RES_TYPE_COUNT 5 +#define CIM_RES_TYPE_COUNT 6 const static int cim_res_types[CIM_RES_TYPE_COUNT] = {CIM_RES_TYPE_NET, CIM_RES_TYPE_DISK, CIM_RES_TYPE_MEM, CIM_RES_TYPE_PROC, CIM_RES_TYPE_GRAPHICS, + CIM_RES_TYPE_INPUT, }; #define CIM_VSSD_RECOVERY_NONE 2

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1224692656 25200 # Node ID 468f398f95b0d521c811f91143b1e5d8809c4a95 # Parent e53b108e82fc54142208dd48a6edd07c2eae0a68 (#2) Add input device support to device_parsing and Virt_Device. Updates: -Add a count value for input devcies Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r e53b108e82fc -r 468f398f95b0 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Wed Oct 22 09:24:16 2008 -0700 +++ b/libxkutil/device_parsing.c Wed Oct 22 09:24:16 2008 -0700 @@ -43,6 +43,7 @@ #define EMU_XPATH (xmlChar *)"/domain/devices/emulator" #define MEM_XPATH (xmlChar *)"/domain/memory | /domain/currentMemory" #define GRAPHICS_XPATH (xmlChar *)"/domain/devices/graphics" +#define INPUT_XPATH (xmlChar *)"/domain/devices/input" #define DEFAULT_BRIDGE "xenbr0" #define DEFAULT_NETWORK "default" @@ -77,6 +78,12 @@ free(dev->port); } +static void cleanup_input_device(struct input_device *dev) +{ + free(dev->type); + free(dev->bus); +} + void cleanup_virt_device(struct virt_device *dev) { if (dev == NULL) @@ -90,6 +97,8 @@ cleanup_emu_device(&dev->dev.emu); else if (dev->type == CIM_RES_TYPE_GRAPHICS) cleanup_graphics_device(&dev->dev.graphics); + else if (dev->type == CIM_RES_TYPE_INPUT) + cleanup_input_device(&dev->dev.input); free(dev->id); @@ -455,6 +464,36 @@ return 0; } +static int parse_input_device(xmlNode *node, struct virt_device **vdevs) +{ + struct virt_device *vdev = NULL; + struct input_device *idev = NULL; + + vdev = calloc(1, sizeof(*vdev)); + if (vdev == NULL) + goto err; + + idev = &(vdev->dev.input); + + idev->type = get_attr_value(node, "type"); + idev->bus = get_attr_value(node, "bus"); + + if ((idev->type == NULL) || (idev->bus == NULL)) + goto err; + + vdev->type = CIM_RES_TYPE_INPUT; + vdev->id = strdup("input"); + + *vdevs = vdev; + + return 1; + err: + cleanup_input_device(idev); + free(vdev); + + return 0; +} + static bool resize_devlist(struct virt_device **list, int newsize) { struct virt_device *_list; @@ -490,6 +529,8 @@ do_real_parse = parse_mem_device; else if (type == CIM_RES_TYPE_GRAPHICS) do_real_parse = parse_graphics_device; + else if (type == CIM_RES_TYPE_INPUT) + do_real_parse = parse_input_device; else goto out; @@ -558,6 +599,8 @@ xpathstr = MEM_XPATH; else if (type == CIM_RES_TYPE_GRAPHICS) xpathstr = GRAPHICS_XPATH; + else if (type == CIM_RES_TYPE_INPUT) + xpathstr = INPUT_XPATH; else goto err1; @@ -622,6 +665,9 @@ } else if (dev->type == CIM_RES_TYPE_GRAPHICS) { DUP_FIELD(dev, _dev, dev.graphics.type); DUP_FIELD(dev, _dev, dev.graphics.port); + } else if (dev->type == CIM_RES_TYPE_INPUT) { + DUP_FIELD(dev, _dev, dev.input.type); + DUP_FIELD(dev, _dev, dev.input.bus); } return dev; @@ -876,6 +922,7 @@ parse_devices(xml, &(*dominfo)->dev_emu, CIM_RES_TYPE_EMU); parse_devices(xml, &(*dominfo)->dev_graphics, CIM_RES_TYPE_GRAPHICS); + parse_devices(xml, &(*dominfo)->dev_input, CIM_RES_TYPE_INPUT); (*dominfo)->dev_mem_ct = _get_mem_device(xml, &(*dominfo)->dev_mem); (*dominfo)->dev_net_ct = parse_devices(xml, diff -r e53b108e82fc -r 468f398f95b0 libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Wed Oct 22 09:24:16 2008 -0700 +++ b/libxkutil/device_parsing.h Wed Oct 22 09:24:16 2008 -0700 @@ -64,6 +64,11 @@ char *port; }; +struct input_device { + char *type; + char *bus; +}; + struct virt_device { uint16_t type; union { @@ -73,6 +78,7 @@ struct vcpu_device vcpu; struct emu_device emu; struct graphics_device graphics; + struct input_device input; } dev; char *id; }; @@ -115,6 +121,9 @@ struct virt_device *dev_graphics; struct virt_device *dev_emu; + + struct virt_device *dev_input; + int dev_input_ct; struct virt_device *dev_mem; int dev_mem_ct; diff -r e53b108e82fc -r 468f398f95b0 src/Virt_Device.c --- a/src/Virt_Device.c Wed Oct 22 09:24:16 2008 -0700 +++ b/src/Virt_Device.c Wed Oct 22 09:24:16 2008 -0700 @@ -39,6 +39,9 @@ #define CIM_NET_UNKNOWN 0 #define CIM_NET_ETHERNET 2 + +#define CIM_INPUT_UNKNOWN 2 +#define CIM_INPUT_MOUSE 3 const static CMPIBroker *_BROKER; const static uint64_t XEN_MEM_BLOCKSIZE = 4096; @@ -214,6 +217,42 @@ return inst; } +static int input_set_attr(CMPIInstance *instance, + struct input_device *dev) +{ + uint16_t cim_type; + + if (STREQC(dev->type, "mouse")) + cim_type = CIM_INPUT_MOUSE; + else + cim_type = CIM_INPUT_UNKNOWN; + + CMSetProperty(instance, "PointingType", + (CMPIValue *)&cim_type, CMPI_uint16); + + return 1; +} + +static CMPIInstance *input_instance(const CMPIBroker *broker, + struct input_device *dev, + const virDomainPtr dom, + const char *ns) +{ + CMPIInstance *inst; + virConnectPtr conn; + + conn = virDomainGetConnect(dom); + inst = get_typed_instance(broker, + pfx_from_conn(conn), + "PointingDevice", + ns); + + if (!input_set_attr(inst, dev)) + return NULL; + + return inst; +} + static int device_set_devid(CMPIInstance *instance, struct virt_device *dev, const virDomainPtr dom) @@ -358,6 +397,11 @@ &dev->dev.graphics, dom, ns); + else if (dev->type == CIM_RES_TYPE_INPUT) + instance = input_instance(broker, + &dev->dev.input, + dom, + ns); else return false; @@ -392,6 +436,8 @@ return CIM_RES_TYPE_PROC; else if (strstr(classname, "DisplayController")) return CIM_RES_TYPE_GRAPHICS; + else if (strstr(classname, "PointingDevice")) + return CIM_RES_TYPE_INPUT; else return CIM_RES_TYPE_UNKNOWN; }

KR> # HG changeset patch KR> # User Kaitlin Rupert <karupert@us.ibm.com> KR> # Date 1224692656 25200 KR> # Node ID 468f398f95b0d521c811f91143b1e5d8809c4a95 KR> # Parent e53b108e82fc54142208dd48a6edd07c2eae0a68 KR> (#2) Add input device support to device_parsing and Virt_Device. I think with this one as well, before we expose a new device in Virt_Device, we want to have the corresponding RASD and the associations to link them all. What do you think? -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

Dan Smith wrote:
KR> # HG changeset patch KR> # User Kaitlin Rupert <karupert@us.ibm.com> KR> # Date 1224692656 25200 KR> # Node ID 468f398f95b0d521c811f91143b1e5d8809c4a95 KR> # Parent e53b108e82fc54142208dd48a6edd07c2eae0a68 KR> (#2) Add input device support to device_parsing and Virt_Device.
I think with this one as well, before we expose a new device in Virt_Device, we want to have the corresponding RASD and the associations to link them all.
What do you think?
Sure, this sounds good. Since the graphics device is already in place, I'll do all the updates for it. Then I'll send the input device / rasd / association updates in a patchset. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (2)
-
Dan Smith
-
Kaitlin Rupert