<div dir="ltr">Njn, když chceš hackovat, tak na to musíš mít křídla :)<div><br></div><div>Z chyby <span style="font-size:12.8000001907349px"><font face="monospace, monospace">'generator' object has no attribute 'set_configuration'</font> je zřejmé, že to <font face="monospace, monospace">usb.core.find</font> vrací iterátor. No a proč to vrací iterátor? Protože <a href="https://github.com/walac/pyusb/blob/a83f17e568bf893bed53fa984f00c1e168348cb9/usb/core.py#L1127">deklarace té funkce</a> je</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span class="" style="color:rgb(167,29,93);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">def</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre"> </span><span class="" style="color:rgb(121,93,163);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">find</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">(</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">find_all</span><span class="" style="color:rgb(167,29,93);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">=</span><span class="" style="color:rgb(0,134,179);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">False</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">, </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">backend</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre"> </span><span class="" style="color:rgb(167,29,93);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">=</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre"> </span><span class="" style="color:rgb(0,134,179);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">None</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">, </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">custom_match</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre"> </span><span class="" style="color:rgb(167,29,93);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">=</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre"> </span><span class="" style="color:rgb(0,134,179);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">None</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">, **</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">args</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">):</span><span style="font-size:12.8000001907349px"><br></span></div><div class="gmail_extra"><br></div><div class="gmail_extra">a když to voláš bez keyword argumentů, tak se jako <font face="monospace, monospace">find_all</font> nastaví to 0x10C48, což se interpretuje podobně jako <font face="monospace, monospace">find_all=True</font>.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Takže o krok zpět k <span style="font-size:12.8000001907349px"><font face="monospace, monospace">ValueError: No backend available</font>.  Podívej se do zdrojáku, co to dělá. Prochází to moduly </span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">usb.backend.libusb1</span><span style="font-size:12.8000001907349px">,</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre"> u</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">sb.backend.libusb0</span><span style="font-size:12.8000001907349px"> a </span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">usb.backend.openusb</span><span style="font-size:12.8000001907349px"> a volá to jejich funkci </span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">get_backend()</span><span style="font-size:12.8000001907349px">, která se snaží danou DLL (nebo .so) knihovnu načíst (protože <font face="monospace, monospace">usb.backend.* </font>jsou jen ctypes wrappery "céčkových" knihoven). Takže problém je v tom, že žádnou z těch knihoven buď nemáš k dispozici, nebo ji pyusb nemůže najít.</span></div><div class="gmail_extra"><span style="font-size:12.8000001907349px"><br></span></div><div class="gmail_extra">PM</div><div class="gmail_extra"><br><div class="gmail_quote">Dne 16. května 2015 16:28 "Ing. Vladislav Ludík" <span dir="ltr"><<a href="mailto:vlada@ludik.cz" target="_blank">vlada@ludik.cz</a>></span> napsal(a):<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Ještě chyby:<br>
<br>
dev = usb.core.find(idVendor=0x10C48, idProduct=0xEA60)<br>
<br>
hlásí chybu:<br>
<br>
dev = usb.core.find(idVendor=0x10C48, idProduct=0xEA60)<br>
  File "build\bdist.win32\egg\usb\core.py", line 1199, in find<br>
    raise ValueError('No backend available')<br>
ValueError: No backend available<br>
<br>
Když jsem změnil řádek na:<br>
<br>
dev = usb.core.find(0x10C48, 0xEA60)<br>
<br>
program projde dále, ale hlásí chybu:<br>
<br>
dev.set_configuration()<br>
AttributeError: 'generator' object has no attribute 'set_configuration'<br>
<br>
Co s tím dále, nevím.<div class=""><div class="h5"><br>
<br>
Díky Vláďa<br>
_______________________________________________<br>
Python mailing list<br>
<a href="mailto:python@py.cz" target="_blank">python@py.cz</a><br>
<a href="http://www.py.cz/mailman/listinfo/python" target="_blank">http://www.py.cz/mailman/listinfo/python</a><br>
<br>
Visit: <a href="http://www.py.cz" target="_blank">http://www.py.cz</a><br>
</div></div></blockquote></div><br></div></div>