<div dir="ltr">So, if I remove the hostdev element related to the USB device, running `lsusb` and `usb-devices` inside the container lists the proper device, but I do not see the appropriate character device bus for the Android device under /dev/bus/usb. We are not entirely sure that `lsusb` and `usb-devices` queries the appropriate location - it somehow gets information from the host, not the guest container, as far as we can tell.<div>


<br></div><div>If we specify the appropriate usb bus character device path (like you suggest, Cheng), then it does appear inside the container, but the permissions and ownership on the device seem to be incorrect. Here are the details of the appropriate device busses in the host (002 and 003 are the specific Android devices):</div>

<div><br></div><div><div>$ ll /dev/bus/usb/002</div><div>total 0</div><div>drwxr-xr-x  2 root root         100 Apr  9 18:14 ./</div><div>drwxr-xr-x 10 root root         200 Apr  9 18:14 ../</div><div>crw-rw-r--  1 root root    189, 128 Apr  9 18:14 001</div>

<div>crw-rw-r--  1 root plugdev 189, 129 Apr  9 18:14 002</div><div>crw-rw-r--  1 root plugdev 189, 130 Apr 10 15:25 003</div></div><div><br></div><div>Then, I removed the old mode="subsystem" hostdev element and added the following hostdev elements:</div>

<div><br></div><div><div>        <hostdev mode='capabilities' type='misc'></div><div>          <source></div><div>            <char>/dev/bus/usb/002/002</char></div><div>          </source></div>

<div>        </hostdev></div><div>        <hostdev mode='capabilities' type='misc'></div><div>          <source></div><div>            <char>/dev/bus/usb/002/003</char></div>
<div>
          </source></div><div>        </hostdev></div></div><div><br></div><div>Then I get inside the guest container and list out the usb busses we just mounted:</div><div><br></div><div><div>$ ll /dev/bus/usb/002/</div>

<div>total 0</div><div>drwxr-xr-x 2 root root       80 Apr 14 17:43 ./</div><div>drwxr-xr-x 3 root root       60 Apr 14 17:43 ../</div><div>crwx------ 1 root root 189, 129 Apr 14 17:43 002</div><div>crwx------ 1 root root 189, 130 Apr 14 17:43 003</div>

</div><div><br></div><div>You can see the group that owns the character devices is different, and the read/write permissions are different, too. Not sure if this is the root of the issue, but, I noticed that difference. In any case, the Android devices are still not recognized by the container.</div>

<div><br></div><div>Any help is appreciated!</div><div><br></div><div>Cheers,</div><div>Fil</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Apr 13, 2014 at 8:50 PM, WANG Cheng D <span dir="ltr"><<a href="mailto:Cheng.d.Wang@alcatel-sbell.com.cn" target="_blank">Cheng.d.Wang@alcatel-sbell.com.cn</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="ZH-CN" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d">Can you see the USB device in the lxc?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d">My answering assumes you cannot see the USB device in the container. If you can see it, please ignore my answer.<u></u><u></u></span></p>


<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d">According to my understanding, “hostdev mode='subsystem' “ is used with KVM only. We use this if we want to passthrough a device to a KVM virtual
 machine. After doing that, the host machine will lose control of the device. If container is used, the container is not a real virtual machine, it’s just a group of processes and it shares the OS kernel with the host. If a device cannot be seen by the host
 machine, I guess it also cannot been seen by the container.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d">I used the following XML scripts to expose a third-party PCIe card to the container successfully, and I can access the card in the lxc.<u></u><u></u></span></p>

<div class="">
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d"><hostdev mode=’capabilities’ type=’misc’><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d">   <source><u></u><u></u></span></p>
</div><p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d">       <char/dev/mydevice</char><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d">  </source><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d"></hostdev><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d">Although I am not sure if my card is a char device, but it really works.<u></u><u></u></span></p>


<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d">If I use “ hostdev mode=’subsystem’”, it will fail to expose the PCIe card.<u></u><u></u></span></p>


<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Filip Maj [mailto:<a href="mailto:fil@saucelabs.com" target="_blank">fil@saucelabs.com</a>]
<br>
<b>Sent:</b> 2014</span><span style="font-size:10.0pt;font-family:宋体">年</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">4</span><span style="font-size:10.0pt;font-family:宋体">月</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">14</span><span style="font-size:10.0pt;font-family:宋体">日</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">
 11:26<br>
<b>To:</b> WANG Cheng D<br>
<b>Cc:</b> <a href="mailto:libvirt-users@redhat.com" target="_blank">libvirt-users@redhat.com</a><br>
<b>Subject:</b> RE: [libvirt-users] LXC + USB passthrough = Operation not permitted<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p><span lang="EN-US">Hi Chang Weng,<u></u><u></u></span></p>
<p><span lang="EN-US">Thanks for answering!<u></u><u></u></span></p>
<p><span lang="EN-US">Could you explain why subsystem=USB does not make sense? I was simply following the documentation for USB devices (right above the section you linked to).<u></u><u></u></span></p>
<p><span lang="EN-US">For what it's worth, I've also tried mounting the specific character device related to the appropriate android device into the container in the way you suggest, with no luck; `adb` still does not recognize the device.<u></u><u></u></span></p>


<div>
<p class="MsoNormal"><span lang="EN-US">On Apr 13, 2014 7:10 PM, "WANG Cheng D" <<a href="mailto:Cheng.d.Wang@alcatel-sbell.com.cn" target="_blank">Cheng.d.Wang@alcatel-sbell.com.cn</a>> wrote:<u></u><u></u></span></p>


<div>
<div>
<p class="MsoNormal"><span lang="EN-US">Dear Fil,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I am not sure if my answer can help you.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I had ever asked a similar question to Daniel and I was using a thirty-party card. As a container uses a shared kernel with the host, so hostdev mode='subsystem'
 doesn’t make sense. Maybe you can try to use hostdev mode='capabilities’. Please see
<a href="http://libvirt.org/formatdomain.html#elementsHostDevCaps" target="_blank">
http://libvirt.org/formatdomain.html#elementsHostDevCaps</a><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Hope this helps<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Cheng Wang<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"> <u></u><u></u></span></p>
</div>
</div>
</div>
</div></div></div>
</div>

</blockquote></div><br></div>