Skip to contentSkip to conversation

Usb 20180427 patches

GIT PULL Applied Gerd Hoffmann 3 participants 6 messages Apr 27, 2018 – Jun 1, 2018

lore
Share & tools
lore
#0 lore raw

The following changes since commit b8846a4d6352b2a1d2012f8b3b9115640524aeda:

vl.c: new function serial_max_hds() (2018-04-26 13:58:29 +0100)

are available in the git repository at:

git://git.kraxel.org/qemu tags/usb-20180427-pull-request

for you to fetch changes up to 0f5c642d49c3a843bd8b8790d7014fd84bcf6405:

ccid-card: include libcacard.h only (2018-04-27 10:57:09 +0200)

----------------------------------------------------------------
usb: ccid bugfix, misc small improvements.

----------------------------------------------------------------

Jason Andryuk (1):
ccid: Fix dwProtocols advertisement of T=0

John Thomson (1):
Fix libusb-1.0.22 deprecated libusb_set_debug with libusb_set_option

Michal Privoznik (1):
ccid-card: include libcacard.h only

 configure                     | 2 +-
 hw/usb/ccid-card-emulated.c   | 5 +----
 hw/usb/ccid-card-passthru.c   | 2 +-
 hw/usb/dev-smartcard-reader.c | 4 ++--
 hw/usb/host-libusb.c          | 4 ++++
 5 files changed, 9 insertions(+), 8 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

[Qemu-devel] [PULL 1/3] ccid: Fix dwProtocols advertisement of T=0

From: Jason Andryuk <[email protected]>

Commit d7d218ef02d87c637d20d64da8f575d434ff6f78 attempted to change dwProtocols to only advertise support for T=0 and not T=1. The change was incorrect as it changed 0x00000003 to 0x00010000.

lsusb -v in a linux guest shows:
"dwProtocols 65536 (Invalid values detected)", though the
smart card could still be accessed. Windows 7 does not detect inserted smart cards and logs the the following Error in the Event Logs:

Source: Smart Card Service
Event ID: 610
Smart Card Reader 'QEMU QEMU USB CCID 0' rejected IOCTL SET_PROTOCOL:
Incorrect function. If this error persists, your smart card or reader may not be functioning correctly

Command Header: 03 00 00 00

Setting to 0x00000001 fixes the Windows issue.

Message-id: [email protected]

---
 hw/usb/dev-smartcard-reader.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/usb/dev-smartcard-reader.c +2 -2
index e6468057a0..cabb564788 100644
@@ -329,8 +329,8 @@ static const uint8_t qemu_ccid_descriptor[] = {
                      */
         0x07,       /* u8  bVoltageSupport; 01h - 5.0v, 02h - 3.0, 03 - 1.8 */
 
-        0x00, 0x00, /* u32 dwProtocols; RRRR PPPP. RRRR = 0000h.*/
-        0x01, 0x00, /* PPPP: 0001h = Protocol T=0, 0002h = Protocol T=1 */
+        0x01, 0x00, /* u32 dwProtocols; RRRR PPPP. RRRR = 0000h.*/
+        0x00, 0x00, /* PPPP: 0001h = Protocol T=0, 0002h = Protocol T=1 */
                     /* u32 dwDefaultClock; in kHZ (0x0fa0 is 4 MHz) */
         0xa0, 0x0f, 0x00, 0x00,
                     /* u32 dwMaximumClock; */
Signature · 1 line
2.9.3
#2 lore raw

[Qemu-devel] [PULL 2/3] Fix libusb-1.0.22 deprecated libusb_set_debug with libusb_set_option

In reply to Gerd Hoffmann

From: John Thomson <[email protected]>

libusb-1.0.22 marked libusb_set_debug deprecated
it is replaced with
libusb_set_option(libusb_context, LIBUSB_OPTION_LOG_LEVEL, libusb_log_level);

details here: https://github.com/libusb/libusb/commit/539f22e2fd916558d11ab9a66f10f461c5593168

Warning here:

CC hw/usb/host-libusb.o
/builds/xen/src/qemu-xen/hw/usb/host-libusb.c: In function 'usb_host_init':
/builds/xen/src/qemu-xen/hw/usb/host-libusb.c:250:5: error: 'libusb_set_debug' is deprecated: Use libusb_set_option instead [-Werror=deprecated-declarations]

     libusb_set_debug(ctx, loglevel);
     ^~~~~~~~~~~~~~~~
In file included from /builds/xen/src/qemu-xen/hw/usb/host-libusb.c:40:0:
/usr/include/libusb-1.0/libusb.h:1300:18: note: declared here
 void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
                  ^~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors
make: *** [/builds/xen/src/qemu-xen/rules.mak:66: hw/usb/host-libusb.o] Error 1
make: Leaving directory '/builds/xen/src/xen/tools/qemu-xen-build'

Message-id: [email protected]

---
 hw/usb/host-libusb.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/usb/host-libusb.c +4 -0
index 1b0be071cc..dc0a8fe295 100644
@@ -247,7 +247,11 @@ static int usb_host_init(void)
     if (rc != 0) {
         return -1;
     }
+#if LIBUSB_API_VERSION >= 0x01000106
+    libusb_set_option(ctx, LIBUSB_OPTION_LOG_LEVEL, loglevel);
+#else
     libusb_set_debug(ctx, loglevel);
+#endif
 #ifdef CONFIG_WIN32
     /* FIXME: add support for Windows. */
 #else
Signature · 1 line
2.9.3
#3 lore raw

Re: [Qemu-devel] [PULL 2/3] Fix libusb-1.0.22 deprecated libusb_set_debug with libusb_set_option

Cc'ing qemu-stable since I can not build it without this patch cherry-picked.

Quoted 47 lines · Gerd Hoffmann

From: John Thomson <[email protected]>

libusb-1.0.22 marked libusb_set_debug deprecated
it is replaced with
libusb_set_option(libusb_context, LIBUSB_OPTION_LOG_LEVEL, libusb_log_level);

details here: https://github.com/libusb/libusb/commit/539f22e2fd916558d11ab9a66f10f461c5593168

Warning here:

CC hw/usb/host-libusb.o
/builds/xen/src/qemu-xen/hw/usb/host-libusb.c: In function 'usb_host_init':
/builds/xen/src/qemu-xen/hw/usb/host-libusb.c:250:5: error: 'libusb_set_debug' is deprecated: Use libusb_set_option instead [-Werror=deprecated-declarations]

     libusb_set_debug(ctx, loglevel);
     ^~~~~~~~~~~~~~~~
In file included from /builds/xen/src/qemu-xen/hw/usb/host-libusb.c:40:0:
/usr/include/libusb-1.0/libusb.h:1300:18: note: declared here
 void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
                  ^~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors
make: *** [/builds/xen/src/qemu-xen/rules.mak:66: hw/usb/host-libusb.o] Error 1
make: Leaving directory '/builds/xen/src/xen/tools/qemu-xen-build'

Message-id: [email protected]

---
 hw/usb/host-libusb.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/usb/host-libusb.c +4 -0
index 1b0be071cc..dc0a8fe295 100644
@@ -247,7 +247,11 @@ static int usb_host_init(void)
     if (rc != 0) {
         return -1;
     }
+#if LIBUSB_API_VERSION >= 0x01000106
+    libusb_set_option(ctx, LIBUSB_OPTION_LOG_LEVEL, loglevel);
+#else
     libusb_set_debug(ctx, loglevel);
+#endif
 #ifdef CONFIG_WIN32
     /* FIXME: add support for Windows. */
 #else
#4 lore raw

[Qemu-devel] [PULL 3/3] ccid-card: include libcacard.h only

In reply to Gerd Hoffmann

From: Michal Privoznik <[email protected]>

When trying to build with latest libcacard-2.5.1, I hit the following error:

In file included from hw/usb/ccid-card-passthru.c:12:0:
/usr/include/cacard/vscard_common.h:26:2: error: #warning "Only <libcacard.h> can be included directly" [-Werror=cpp]
#warning "Only <libcacard.h> can be included directly"

While it was fixed in libcacard upstream (so that individual files can be included directly), it doesn't make much sense. Let's switch to including the main libcacard.h and also require at least libcacard-2.5.1 which introduced it. It's available since late 2015.

Message-id: 3c36db1dc0702763ebb7966cc27428ed67d43804.1522751624.git.mprivozn@redhat.com

[ kraxel: fix include path ]

---
 configure                   | 2 +-
 hw/usb/ccid-card-emulated.c | 5 +----
 hw/usb/ccid-card-passthru.c | 2 +-
 3 files changed, 3 insertions(+), 6 deletions(-)
configure +1 -1
index 0a19b033bc..0a4f0da58f 100755
@@ -4449,7 +4449,7 @@ fi
 
 # check for smartcard support
 if test "$smartcard" != "no"; then
-    if $pkg_config libcacard; then
+    if $pkg_config --atleast-version=2.5.1 libcacard; then
         libcacard_cflags=$($pkg_config --cflags libcacard)
         libcacard_libs=$($pkg_config --libs libcacard)
         smartcard="yes"
hw/usb/ccid-card-emulated.c +1 -4
index ea42e4681d..5c8b3c9907 100644
@@ -27,10 +27,7 @@
  */
 
 #include "qemu/osdep.h"
-#include <eventt.h>
-#include <vevent.h>
-#include <vreader.h>
-#include <vcard_emul.h>
+#include <libcacard.h>
 
 #include "qemu/thread.h"
 #include "qemu/main-loop.h"
hw/usb/ccid-card-passthru.c +1 -1
index b7dd3602dc..7684db0cb3 100644
@@ -9,7 +9,7 @@
  */
 
 #include "qemu/osdep.h"
-#include <cacard/vscard_common.h>
+#include <libcacard.h>
 #include "chardev/char-fe.h"
 #include "qemu/error-report.h"
 #include "qemu/sockets.h"
Signature · 1 line
2.9.3
#5 lore raw
In reply to Gerd Hoffmann
Quoted 8 lines · Gerd Hoffmann

The following changes since commit b8846a4d6352b2a1d2012f8b3b9115640524aeda:

vl.c: new function serial_max_hds() (2018-04-26 13:58:29 +0100)

are available in the git repository at:

git://git.kraxel.org/qemu tags/usb-20180427-pull-request

Quoted 8 lines

for you to fetch changes up to 0f5c642d49c3a843bd8b8790d7014fd84bcf6405:

ccid-card: include libcacard.h only (2018-04-27 10:57:09 +0200)

----------------------------------------------------------------
usb: ccid bugfix, misc small improvements.

----------------------------------------------------------------

Applied, thanks.

-- PMM