2 * Copyright (c) 2009, Citrix Systems, Inc.
3 * Copyright (c) 2010, Microsoft Corporation.
4 * Copyright (c) 2011, Novell Inc.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 #include <linux/init.h>
16 #include <linux/module.h>
17 #include <linux/delay.h>
18 #include <linux/device.h>
19 #include <linux/workqueue.h>
20 #include <linux/sched.h>
21 #include <linux/wait.h>
22 #include <linux/input.h>
23 #include <linux/hid.h>
24 #include <linux/hiddev.h>
25 #include <linux/pci.h>
26 #include <linux/dmi.h>
27 #include <linux/delay.h>
32 #include "version_info.h"
34 #include "vmbus_api.h"
36 #include "vmbus_packet_format.h"
42 struct hv_input_dev_info
{
43 unsigned short vendor
;
44 unsigned short product
;
45 unsigned short version
;
49 /* The maximum size of a synthetic input message. */
50 #define SYNTHHID_MAX_INPUT_REPORT_SIZE 16
56 * Beta, RC < 2008/1/22 1,0
59 #define SYNTHHID_INPUT_VERSION_MAJOR 2
60 #define SYNTHHID_INPUT_VERSION_MINOR 0
61 #define SYNTHHID_INPUT_VERSION (SYNTHHID_INPUT_VERSION_MINOR | \
62 (SYNTHHID_INPUT_VERSION_MAJOR << 16))
67 * Message types in the synthetic input protocol
69 enum synthhid_msg_type
{
70 SynthHidProtocolRequest
,
71 SynthHidProtocolResponse
,
72 SynthHidInitialDeviceInfo
,
73 SynthHidInitialDeviceInfoAck
,
79 * Basic message structures.
81 struct synthhid_msg_hdr
{
82 enum synthhid_msg_type type
;
87 struct synthhid_msg_hdr header
;
88 char data
[1]; /* Enclosed message */
91 union synthhid_version
{
102 struct synthhid_protocol_request
{
103 struct synthhid_msg_hdr header
;
104 union synthhid_version version_requested
;
107 struct synthhid_protocol_response
{
108 struct synthhid_msg_hdr header
;
109 union synthhid_version version_requested
;
110 unsigned char approved
;
113 struct synthhid_device_info
{
114 struct synthhid_msg_hdr header
;
115 struct hv_input_dev_info hid_dev_info
;
116 struct hid_descriptor hid_descriptor
;
119 struct synthhid_device_info_ack
{
120 struct synthhid_msg_hdr header
;
121 unsigned char reserved
;
124 struct synthhid_input_report
{
125 struct synthhid_msg_hdr header
;
131 #define INPUTVSC_SEND_RING_BUFFER_SIZE 10*PAGE_SIZE
132 #define INPUTVSC_RECV_RING_BUFFER_SIZE 10*PAGE_SIZE
134 #define NBITS(x) (((x)/BITS_PER_LONG)+1)
136 enum pipe_prot_msg_type
{
137 PipeMessageInvalid
= 0,
143 struct pipe_prt_msg
{
144 enum pipe_prot_msg_type type
;
152 struct mousevsc_prt_msg
{
153 enum pipe_prot_msg_type type
;
156 struct synthhid_protocol_request request
;
157 struct synthhid_protocol_response response
;
158 struct synthhid_device_info_ack ack
;
163 * Represents an mousevsc device
165 struct mousevsc_dev
{
166 struct hv_device
*device
;
167 /* 0 indicates the device is being destroyed */
169 int num_outstanding_req
;
170 unsigned char init_complete
;
171 struct mousevsc_prt_msg protocol_req
;
172 struct mousevsc_prt_msg protocol_resp
;
173 /* Synchronize the request/response if needed */
174 wait_queue_head_t protocol_wait_event
;
175 wait_queue_head_t dev_info_wait_event
;
176 int protocol_wait_condition
;
177 int device_wait_condition
;
180 struct hid_descriptor
*hid_desc
;
181 unsigned char *report_desc
;
182 u32 report_desc_size
;
183 struct hv_input_dev_info hid_dev_info
;
187 static const char *driver_name
= "mousevsc";
189 /* {CFA8B69E-5B4A-4cc0-B98B-8BA1A1F3F95A} */
190 static const struct hv_guid mouse_guid
= {
191 .data
= {0x9E, 0xB6, 0xA8, 0xCF, 0x4A, 0x5B, 0xc0, 0x4c,
192 0xB9, 0x8B, 0x8B, 0xA1, 0xA1, 0xF3, 0xF9, 0x5A}
195 static void deviceinfo_callback(struct hv_device
*dev
, struct hv_input_dev_info
*info
);
196 static void inputreport_callback(struct hv_device
*dev
, void *packet
, u32 len
);
197 static void reportdesc_callback(struct hv_device
*dev
, void *packet
, u32 len
);
199 static struct mousevsc_dev
*alloc_input_device(struct hv_device
*device
)
201 struct mousevsc_dev
*input_dev
;
203 input_dev
= kzalloc(sizeof(struct mousevsc_dev
), GFP_KERNEL
);
209 * Set to 2 to allow both inbound and outbound traffics
210 * (ie get_input_device() and must_get_input_device()) to proceed.
212 atomic_cmpxchg(&input_dev
->ref_count
, 0, 2);
214 input_dev
->device
= device
;
215 device
->ext
= input_dev
;
220 static void free_input_device(struct mousevsc_dev
*device
)
222 WARN_ON(atomic_read(&device
->ref_count
) == 0);
227 * Get the inputdevice object if exists and its refcount > 1
229 static struct mousevsc_dev
*get_input_device(struct hv_device
*device
)
231 struct mousevsc_dev
*input_dev
;
233 input_dev
= (struct mousevsc_dev
*)device
->ext
;
237 * This sure isn't a valid thing to print for debugging, no matter
238 * what the intention is...
240 * printk(KERN_ERR "-------------------------> REFCOUNT = %d",
241 * input_dev->ref_count);
244 if (input_dev
&& atomic_read(&input_dev
->ref_count
) > 1)
245 atomic_inc(&input_dev
->ref_count
);
253 * Get the inputdevice object iff exists and its refcount > 0
255 static struct mousevsc_dev
*must_get_input_device(struct hv_device
*device
)
257 struct mousevsc_dev
*input_dev
;
259 input_dev
= (struct mousevsc_dev
*)device
->ext
;
261 if (input_dev
&& atomic_read(&input_dev
->ref_count
))
262 atomic_inc(&input_dev
->ref_count
);
269 static void put_input_device(struct hv_device
*device
)
271 struct mousevsc_dev
*input_dev
;
273 input_dev
= (struct mousevsc_dev
*)device
->ext
;
275 atomic_dec(&input_dev
->ref_count
);
279 * Drop ref count to 1 to effectively disable get_input_device()
281 static struct mousevsc_dev
*release_input_device(struct hv_device
*device
)
283 struct mousevsc_dev
*input_dev
;
285 input_dev
= (struct mousevsc_dev
*)device
->ext
;
287 /* Busy wait until the ref drop to 2, then set it to 1 */
288 while (atomic_cmpxchg(&input_dev
->ref_count
, 2, 1) != 2)
295 * Drop ref count to 0. No one can use input_device object.
297 static struct mousevsc_dev
*final_release_input_device(struct hv_device
*device
)
299 struct mousevsc_dev
*input_dev
;
301 input_dev
= (struct mousevsc_dev
*)device
->ext
;
303 /* Busy wait until the ref drop to 1, then set it to 0 */
304 while (atomic_cmpxchg(&input_dev
->ref_count
, 1, 0) != 1)
311 static void mousevsc_on_send_completion(struct hv_device
*device
,
312 struct vmpacket_descriptor
*packet
)
314 struct mousevsc_dev
*input_dev
;
317 input_dev
= must_get_input_device(device
);
319 pr_err("unable to get input device...device being destroyed?");
323 request
= (void *)(unsigned long)packet
->trans_id
;
325 if (request
== &input_dev
->protocol_req
) {
327 /* Shouldn't we be doing something here? */
330 put_input_device(device
);
333 static void mousevsc_on_receive_device_info(struct mousevsc_dev
*input_device
,
334 struct synthhid_device_info
*device_info
)
337 struct hid_descriptor
*desc
;
338 struct mousevsc_prt_msg ack
;
340 /* Assume success for now */
341 input_device
->dev_info_status
= 0;
343 /* Save the device attr */
344 memcpy(&input_device
->hid_dev_info
, &device_info
->hid_dev_info
,
345 sizeof(struct hv_input_dev_info
));
347 /* Save the hid desc */
348 desc
= &device_info
->hid_descriptor
;
349 WARN_ON(desc
->bLength
> 0);
351 input_device
->hid_desc
= kzalloc(desc
->bLength
, GFP_KERNEL
);
353 if (!input_device
->hid_desc
) {
354 pr_err("unable to allocate hid descriptor - size %d", desc
->bLength
);
358 memcpy(input_device
->hid_desc
, desc
, desc
->bLength
);
360 /* Save the report desc */
361 input_device
->report_desc_size
= desc
->desc
[0].wDescriptorLength
;
362 input_device
->report_desc
= kzalloc(input_device
->report_desc_size
,
365 if (!input_device
->report_desc
) {
366 pr_err("unable to allocate report descriptor - size %d",
367 input_device
->report_desc_size
);
371 memcpy(input_device
->report_desc
,
372 ((unsigned char *)desc
) + desc
->bLength
,
373 desc
->desc
[0].wDescriptorLength
);
376 memset(&ack
, 0, sizeof(struct mousevsc_prt_msg
));
378 ack
.type
= PipeMessageData
;
379 ack
.size
= sizeof(struct synthhid_device_info_ack
);
381 ack
.ack
.header
.type
= SynthHidInitialDeviceInfoAck
;
382 ack
.ack
.header
.size
= 1;
383 ack
.ack
.reserved
= 0;
385 ret
= vmbus_sendpacket(input_device
->device
->channel
,
387 sizeof(struct pipe_prt_msg
) - sizeof(unsigned char) +
388 sizeof(struct synthhid_device_info_ack
),
391 VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED
);
393 pr_err("unable to send synthhid device info ack - ret %d",
398 input_device
->device_wait_condition
= 1;
399 wake_up(&input_device
->dev_info_wait_event
);
404 kfree(input_device
->hid_desc
);
405 input_device
->hid_desc
= NULL
;
407 kfree(input_device
->report_desc
);
408 input_device
->report_desc
= NULL
;
410 input_device
->dev_info_status
= -1;
411 input_device
->device_wait_condition
= 1;
412 wake_up(&input_device
->dev_info_wait_event
);
415 static void mousevsc_on_receive_input_report(struct mousevsc_dev
*input_device
,
416 struct synthhid_input_report
*input_report
)
418 struct hv_driver
*input_drv
;
420 if (!input_device
->init_complete
) {
421 pr_info("Initialization incomplete...ignoring input_report msg");
425 input_drv
= drv_to_hv_drv(input_device
->device
->device
.driver
);
427 inputreport_callback(input_device
->device
,
428 input_report
->buffer
,
429 input_report
->header
.size
);
432 static void mousevsc_on_receive(struct hv_device
*device
,
433 struct vmpacket_descriptor
*packet
)
435 struct pipe_prt_msg
*pipe_msg
;
436 struct synthhid_msg
*hid_msg
;
437 struct mousevsc_dev
*input_dev
;
439 input_dev
= must_get_input_device(device
);
441 pr_err("unable to get input device...device being destroyed?");
445 pipe_msg
= (struct pipe_prt_msg
*)((unsigned long)packet
+
446 (packet
->offset8
<< 3));
448 if (pipe_msg
->type
!= PipeMessageData
) {
449 pr_err("unknown pipe msg type - type %d len %d",
450 pipe_msg
->type
, pipe_msg
->size
);
451 put_input_device(device
);
455 hid_msg
= (struct synthhid_msg
*)&pipe_msg
->data
[0];
457 switch (hid_msg
->header
.type
) {
458 case SynthHidProtocolResponse
:
459 memcpy(&input_dev
->protocol_resp
, pipe_msg
,
460 pipe_msg
->size
+ sizeof(struct pipe_prt_msg
) -
461 sizeof(unsigned char));
462 input_dev
->protocol_wait_condition
= 1;
463 wake_up(&input_dev
->protocol_wait_event
);
466 case SynthHidInitialDeviceInfo
:
467 WARN_ON(pipe_msg
->size
>= sizeof(struct hv_input_dev_info
));
470 * Parse out the device info into device attr,
471 * hid desc and report desc
473 mousevsc_on_receive_device_info(input_dev
,
474 (struct synthhid_device_info
*)&pipe_msg
->data
[0]);
476 case SynthHidInputReport
:
477 mousevsc_on_receive_input_report(input_dev
,
478 (struct synthhid_input_report
*)&pipe_msg
->data
[0]);
482 pr_err("unsupported hid msg type - type %d len %d",
483 hid_msg
->header
.type
, hid_msg
->header
.size
);
487 put_input_device(device
);
490 static void mousevsc_on_channel_callback(void *context
)
492 const int packetSize
= 0x100;
494 struct hv_device
*device
= (struct hv_device
*)context
;
495 struct mousevsc_dev
*input_dev
;
499 unsigned char packet
[packetSize
];
500 struct vmpacket_descriptor
*desc
;
501 unsigned char *buffer
= packet
;
502 int bufferlen
= packetSize
;
504 input_dev
= must_get_input_device(device
);
507 pr_err("unable to get input device...device being destroyed?");
512 ret
= vmbus_recvpacket_raw(device
->channel
, buffer
,
513 bufferlen
, &bytes_recvd
, &req_id
);
516 if (bytes_recvd
> 0) {
517 desc
= (struct vmpacket_descriptor
*)buffer
;
519 switch (desc
->type
) {
521 mousevsc_on_send_completion(
525 case VM_PKT_DATA_INBAND
:
531 pr_err("unhandled packet type %d, tid %llx len %d\n",
539 if (bufferlen
> packetSize
) {
543 bufferlen
= packetSize
;
547 * pr_debug("nothing else to read...");
550 if (bufferlen
> packetSize
) {
554 bufferlen
= packetSize
;
558 } else if (ret
== -2) {
559 /* Handle large packet */
560 bufferlen
= bytes_recvd
;
561 buffer
= kzalloc(bytes_recvd
, GFP_KERNEL
);
563 if (buffer
== NULL
) {
565 bufferlen
= packetSize
;
567 /* Try again next time around */
568 pr_err("unable to allocate buffer of size %d!",
575 put_input_device(device
);
580 static int mousevsc_connect_to_vsp(struct hv_device
*device
)
583 struct mousevsc_dev
*input_dev
;
584 struct mousevsc_prt_msg
*request
;
585 struct mousevsc_prt_msg
*response
;
587 input_dev
= get_input_device(device
);
590 pr_err("unable to get input device...device being destroyed?");
594 init_waitqueue_head(&input_dev
->protocol_wait_event
);
595 init_waitqueue_head(&input_dev
->dev_info_wait_event
);
597 request
= &input_dev
->protocol_req
;
600 * Now, initiate the vsc/vsp initialization protocol on the open channel
602 memset(request
, 0, sizeof(struct mousevsc_prt_msg
));
604 request
->type
= PipeMessageData
;
605 request
->size
= sizeof(struct synthhid_protocol_request
);
607 request
->request
.header
.type
= SynthHidProtocolRequest
;
608 request
->request
.header
.size
= sizeof(unsigned long);
609 request
->request
.version_requested
.version
= SYNTHHID_INPUT_VERSION
;
611 pr_info("synthhid protocol request...");
613 ret
= vmbus_sendpacket(device
->channel
, request
,
614 sizeof(struct pipe_prt_msg
) -
615 sizeof(unsigned char) +
616 sizeof(struct synthhid_protocol_request
),
617 (unsigned long)request
,
619 VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED
);
621 pr_err("unable to send synthhid protocol request.");
625 input_dev
->protocol_wait_condition
= 0;
626 wait_event_timeout(input_dev
->protocol_wait_event
,
627 input_dev
->protocol_wait_condition
, msecs_to_jiffies(1000));
628 if (input_dev
->protocol_wait_condition
== 0) {
633 response
= &input_dev
->protocol_resp
;
635 if (!response
->response
.approved
) {
636 pr_err("synthhid protocol request failed (version %d)",
637 SYNTHHID_INPUT_VERSION
);
642 input_dev
->device_wait_condition
= 0;
643 wait_event_timeout(input_dev
->dev_info_wait_event
,
644 input_dev
->device_wait_condition
, msecs_to_jiffies(1000));
645 if (input_dev
->device_wait_condition
== 0) {
651 * We should have gotten the device attr, hid desc and report
654 if (!input_dev
->dev_info_status
)
655 pr_info("**** input channel up and running!! ****");
660 put_input_device(device
);
665 static int mousevsc_on_device_add(struct hv_device
*device
,
666 void *additional_info
)
669 struct mousevsc_dev
*input_dev
;
670 struct hv_driver
*input_drv
;
671 struct hv_input_dev_info dev_info
;
673 input_dev
= alloc_input_device(device
);
680 input_dev
->init_complete
= false;
682 /* Open the channel */
683 ret
= vmbus_open(device
->channel
,
684 INPUTVSC_SEND_RING_BUFFER_SIZE
,
685 INPUTVSC_RECV_RING_BUFFER_SIZE
,
688 mousevsc_on_channel_callback
,
693 pr_err("unable to open channel: %d", ret
);
694 free_input_device(input_dev
);
698 pr_info("InputVsc channel open: %d", ret
);
700 ret
= mousevsc_connect_to_vsp(device
);
703 pr_err("unable to connect channel: %d", ret
);
705 vmbus_close(device
->channel
);
706 free_input_device(input_dev
);
710 input_drv
= drv_to_hv_drv(input_dev
->device
->device
.driver
);
712 dev_info
.vendor
= input_dev
->hid_dev_info
.vendor
;
713 dev_info
.product
= input_dev
->hid_dev_info
.product
;
714 dev_info
.version
= input_dev
->hid_dev_info
.version
;
715 strcpy(dev_info
.name
, "Microsoft Vmbus HID-compliant Mouse");
717 /* Send the device info back up */
718 deviceinfo_callback(device
, &dev_info
);
720 /* Send the report desc back up */
721 /* workaround SA-167 */
722 if (input_dev
->report_desc
[14] == 0x25)
723 input_dev
->report_desc
[14] = 0x29;
725 reportdesc_callback(device
, input_dev
->report_desc
,
726 input_dev
->report_desc_size
);
728 input_dev
->init_complete
= true;
734 static int mousevsc_on_device_remove(struct hv_device
*device
)
736 struct mousevsc_dev
*input_dev
;
739 pr_info("disabling input device (%p)...",
742 input_dev
= release_input_device(device
);
746 * At this point, all outbound traffic should be disable. We only
747 * allow inbound traffic (responses) to proceed
749 * so that outstanding requests can be completed.
751 while (input_dev
->num_outstanding_req
) {
752 pr_info("waiting for %d requests to complete...",
753 input_dev
->num_outstanding_req
);
758 pr_info("removing input device (%p)...", device
->ext
);
760 input_dev
= final_release_input_device(device
);
762 pr_info("input device (%p) safe to remove", input_dev
);
764 /* Close the channel */
765 vmbus_close(device
->channel
);
767 free_input_device(input_dev
);
776 struct input_device_context
{
777 struct hv_device
*device_ctx
;
778 struct hid_device
*hid_device
;
779 struct hv_input_dev_info device_info
;
784 static void deviceinfo_callback(struct hv_device
*dev
, struct hv_input_dev_info
*info
)
786 struct input_device_context
*input_device_ctx
=
787 dev_get_drvdata(&dev
->device
);
789 memcpy(&input_device_ctx
->device_info
, info
,
790 sizeof(struct hv_input_dev_info
));
792 DPRINT_INFO(INPUTVSC_DRV
, "%s", __func__
);
795 static void inputreport_callback(struct hv_device
*dev
, void *packet
, u32 len
)
799 struct input_device_context
*input_dev_ctx
=
800 dev_get_drvdata(&dev
->device
);
802 ret
= hid_input_report(input_dev_ctx
->hid_device
,
803 HID_INPUT_REPORT
, packet
, len
, 1);
805 DPRINT_DBG(INPUTVSC_DRV
, "hid_input_report (ret %d)", ret
);
808 static int mousevsc_hid_open(struct hid_device
*hid
)
813 static void mousevsc_hid_close(struct hid_device
*hid
)
817 static int mousevsc_probe(struct hv_device
*dev
)
821 struct input_device_context
*input_dev_ctx
;
823 input_dev_ctx
= kmalloc(sizeof(struct input_device_context
),
826 dev_set_drvdata(&dev
->device
, input_dev_ctx
);
828 /* Call to the vsc driver to add the device */
829 ret
= mousevsc_on_device_add(dev
, NULL
);
832 DPRINT_ERR(INPUTVSC_DRV
, "unable to add input vsc device");
840 static int mousevsc_remove(struct hv_device
*dev
)
844 struct input_device_context
*input_dev_ctx
;
846 input_dev_ctx
= kmalloc(sizeof(struct input_device_context
),
849 dev_set_drvdata(&dev
->device
, input_dev_ctx
);
851 if (input_dev_ctx
->connected
) {
852 hidinput_disconnect(input_dev_ctx
->hid_device
);
853 input_dev_ctx
->connected
= 0;
857 * Call to the vsc driver to let it know that the device
860 ret
= mousevsc_on_device_remove(dev
);
863 DPRINT_ERR(INPUTVSC_DRV
,
864 "unable to remove vsc device (ret %d)", ret
);
867 kfree(input_dev_ctx
);
872 static void reportdesc_callback(struct hv_device
*dev
, void *packet
, u32 len
)
874 struct input_device_context
*input_device_ctx
=
875 dev_get_drvdata(&dev
->device
);
876 struct hid_device
*hid_dev
;
878 /* hid_debug = -1; */
879 hid_dev
= kmalloc(sizeof(struct hid_device
), GFP_KERNEL
);
881 if (hid_parse_report(hid_dev
, packet
, len
)) {
882 DPRINT_INFO(INPUTVSC_DRV
, "Unable to call hd_parse_report");
887 DPRINT_INFO(INPUTVSC_DRV
, "hid_device created");
889 hid_dev
->ll_driver
->open
= mousevsc_hid_open
;
890 hid_dev
->ll_driver
->close
= mousevsc_hid_close
;
892 hid_dev
->bus
= BUS_VIRTUAL
;
893 hid_dev
->vendor
= input_device_ctx
->device_info
.vendor
;
894 hid_dev
->product
= input_device_ctx
->device_info
.product
;
895 hid_dev
->version
= input_device_ctx
->device_info
.version
;
896 hid_dev
->dev
= dev
->device
;
898 sprintf(hid_dev
->name
, "%s",
899 input_device_ctx
->device_info
.name
);
902 * HJ Do we want to call it with a 0
904 if (!hidinput_connect(hid_dev
, 0)) {
905 hid_dev
->claimed
|= HID_CLAIMED_INPUT
;
907 input_device_ctx
->connected
= 1;
909 DPRINT_INFO(INPUTVSC_DRV
,
910 "HID device claimed by input\n");
913 if (!hid_dev
->claimed
) {
914 DPRINT_ERR(INPUTVSC_DRV
,
915 "HID device not claimed by "
916 "input or hiddev\n");
919 input_device_ctx
->hid_device
= hid_dev
;
925 static int mousevsc_drv_exit_cb(struct device
*dev
, void *data
)
927 struct device
**curr
= (struct device
**)data
;
933 static struct hv_driver mousevsc_drv
= {
934 .probe
= mousevsc_probe
,
935 .remove
= mousevsc_remove
,
938 static void mousevsc_drv_exit(void)
940 struct hv_driver
*drv
= &mousevsc_drv
;
943 struct device
*current_dev
= NULL
;
949 ret
= driver_for_each_device(&drv
->driver
, NULL
,
950 (void *)¤t_dev
,
951 mousevsc_drv_exit_cb
);
953 printk(KERN_ERR
"Can't find mouse device!\n");
955 if (current_dev
== NULL
)
958 /* Initiate removal from the top-down */
959 device_unregister(current_dev
);
962 vmbus_child_driver_unregister(&drv
->driver
);
967 static int __init
mousevsc_init(void)
969 struct hv_driver
*drv
= &mousevsc_drv
;
971 DPRINT_INFO(INPUTVSC_DRV
, "Hyper-V Mouse driver initializing.");
973 memcpy(&drv
->dev_type
, &mouse_guid
,
974 sizeof(struct hv_guid
));
976 drv
->driver
.name
= driver_name
;
977 drv
->name
= driver_name
;
979 /* The driver belongs to vmbus */
980 vmbus_child_driver_register(&drv
->driver
);
985 static void __exit
mousevsc_exit(void)
991 * We don't want to automatically load this driver just yet, it's quite
992 * broken. It's safe if you want to load it yourself manually, but
993 * don't inflict it on unsuspecting users, that's just mean.
998 * We use a PCI table to determine if we should autoload this driver This is
999 * needed by distro tools to determine if the hyperv drivers should be
1000 * installed and/or configured. We don't do anything else with the table, but
1001 * it needs to be present.
1003 const static struct pci_device_id microsoft_hv_pci_table
[] = {
1004 { PCI_DEVICE(0x1414, 0x5353) }, /* VGA compatible controller */
1007 MODULE_DEVICE_TABLE(pci
, microsoft_hv_pci_table
);
1010 MODULE_LICENSE("GPL");
1011 MODULE_VERSION(HV_DRV_VERSION
);
1012 module_init(mousevsc_init
);
1013 module_exit(mousevsc_exit
);