<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:新細明體;
panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
{font-family:細明體;
panose-1:2 2 5 9 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"\@新細明體";
panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
{font-family:"\@細明體";
panose-1:2 2 5 9 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Please ignore my question. It is my fault.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Charles.Tsai-</span><span lang="ZH-TW" style="font-size:10.0pt;font-family:"新細明體","serif"">蔡清海</span><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">-</span><span lang="ZH-TW" style="font-size:10.0pt;font-family:"新細明體","serif"">研究發展部</span><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">
<br>
<b>Sent:</b> Thursday, June 21, 2012 5:56 PM<br>
<b>To:</b> 'spice-devel@lists.freedesktop.org'<br>
<b>Subject:</b> VirtIO bug (Mouse & Keyboard fail to work after opeining an non-exist serial port)<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">We implemented an virt IO port for printing channel. It works without any problem if Qemu command options specify our printing device.<o:p></o:p></p>
<p class="MsoNormal">However, we found a bug in virtio serial driver when a VM is launched without specifying the “printing device” from the qemu command line.<o:p></o:p></p>
<p class="MsoNormal">In this case, mouse click does not work and no any key can be typed from keyboard.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">In application(vdservice), it simply calls the following API to open the underline device.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:細明體"> _handle = CreateFile(DeviceName, GENERIC_READ | GENERIC_WRITE , 0, NULL,<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:細明體"> OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:細明體">
<span style="color:blue">if</span> (_handle == INVALID_HANDLE_VALUE) {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:細明體"> vd_printf(<span style="color:#A31515">"CreateFile() %ls failed: %lu"</span>, DeviceName, GetLastError());<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:細明體">
<span style="color:blue">return</span> <span style="color:blue">false</span>;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:細明體"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:細明體"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:細明體">For working case, virioserial driver shows that both
</span><span style="font-size:9.0pt;font-family:"Times New Roman","serif"">“</span>com.redhat.spice.0” and “com.redhat.print.0” are opened.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">00000001 0.00000000 ==>VIOSerialPortCreate Port id = 1
<o:p></o:p></p>
<p class="MsoNormal">00000002 0.00001717 Port Name =com.redhat.spice.0
<o:p></o:p></p>
<p class="MsoNormal">………………………………….<o:p></o:p></p>
<p class="MsoNormal">00000107 0.00481843 ==>VIOSerialPortCreate Port id = 2
<o:p></o:p></p>
<p class="MsoNormal">00000108 0.00483288 Port Name =com.redhat.print.0
<o:p></o:p></p>
<p class="MsoNormal">00000109 0.00484705 No more buffers in queue: last_used_idx 0 vring.used->idx 0<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">For the failure case, “<span style="font-size:9.0pt;font-family:細明體">CreateFile</span><span style="font-size:9.0pt;font-family:"Times New Roman","serif"">”</span><span style="font-size:9.0pt;font-family:細明體"> fails because it cannot open
</span><span style="font-size:9.0pt;font-family:"Times New Roman","serif"">“</span>com.redhat.print.0” device. But trace message of
<span style="font-size:9.0pt;font-family:細明體">virioserial driver only shows that </span>
<span style="font-size:9.0pt;font-family:"Times New Roman","serif"">“</span>com.redhat.spice.0” is opened.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If <span style="font-size:9.0pt;font-family:細明體">virioserial is not touched for
</span>“com.redhat.print.0” device, why it affects the “com.redhat.spice.0” device?<o:p></o:p></p>
</div>
</body>
</html>