<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div id="appendonsend" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I've found my answer in compositor-rdp.c which was to simply init and create a seat
<span id="🙂">🙂 not a big surprise. </span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<div style="color: #d4d4d4; background-color: #1e1e1e; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; line-height: 19px">
<div><span style="color: #569cd6">struct</span><span> </span><span style="color: #4ec9b0">weston_seat</span><span> </span><span style="color: #569cd6">*</span><span style="color: #9cdcfe">seat</span><span> </span><span>=</span><span> </span><span style="color: #dcdcaa">zalloc</span><span>(</span><span style="color: #569cd6">sizeof</span><span>(</span><span>*</span><span>seat));</span></div>
<div><span style="color: #dcdcaa">weston_seat_init</span><span>(</span><span style="color: #4ec9b0">seat</span><span>, </span><span style="color: #4ec9b0">compositor</span><span>, </span><span style="color: #ce9178">"my_seat"</span><span>);</span></div>
<div><span>
<div style="color: #d4d4d4; background-color: #1e1e1e; font-family: Consolas, 'Courier New', monospace; font-weight: normal">
<div><span style="color: #dcdcaa">weston_seat_init_pointer</span><span>(</span><span style="color: #4ec9b0">seat</span><span>);</span></div>
</div>
<br>
</span></div>
</div>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I am curious to know why there was an existing seat "default" which did not work?</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Regards,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
JS</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Josh Simonot <jsimonot@live.ca><br>
<b>Sent:</b> December 6, 2019 2:51 PM<br>
<b>To:</b> wayland-devel@lists.freedesktop.org <wayland-devel@lists.freedesktop.org><br>
<b>Subject:</b> Input event notify or injection in Weston</font>
<div> </div>
</div>
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hello, </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I have the need to pass input events from a hypervisor host into a guest running weston.  I already have a custom protocol in weston to share surfaces with the host, and I'm hoping it makes sense to extend it to send input back to the guest.</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
So does it make sense to route these input events through libweston?  <span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:12pt">I've found the functions:  notify_key(), notify_button(), notify_motion_absolute(), etc.   I was trying
 to use these to inject the events but end up causing weston to segfault:</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>[22:14:37.440] caught signal: 11<br>
</span>
<div>[22:14:37.442]   [0000000000405c9a]  --  (weston)<br>
</div>
<div>[22:14:37.442]   [0000000000405d07]  --  (weston)<br>
</div>
<div>[22:14:37.444]   [00000034a0e34380]  --  (/lib/libc.so.6)<br>
</div>
<div>[22:14:37.446]   [00000034a321a380]  notify_button  (/usr/lib/libweston-3.so.0)<br>
</div>
<div>[22:14:37.447]   [00007ff73b747302]  --  (/usr/lib/libweston-3/drm-backend.so)<br>
</div>
<div>[22:14:37.449]   [00000034a1207477]  --  (/lib/libpthread.so.0)<br>
</div>
<span>[22:14:37.450]   [00000034a0ef23bf]  clone  (/lib/libc.so.6)</span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I suspect I don't have a valid weston_seat, which I get like this:</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>struct udev_seat *udev_seat = udev_seat_get_named(input, "default");<br>
</span>
<div>struct weston_seat *seat = &udev_seat->base;<br>
</div>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Where "default" is the only existing seat in the list.  I didn't create or add any.</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<ol>
<li>Is this the right approach?  Any hints on how to make it work?</li><li><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:12pt">One alternative I'm considering is to use uinput to create virtual input devices and send the events to that.  Any other alternatives that might be more appropriate
 than the above?</span><br>
</li></ol>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:12pt">Thanks! </span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
-JS</div>
</div>
</body>
</html>