* [Qemu-devel] [PULL 1/3] ccid: Fix dwProtocols advertisement of T=0
2018-04-27 10:20 [Qemu-devel] [PULL 0/3] Usb 20180427 patches Gerd Hoffmann
@ 2018-04-27 10:20 ` Gerd Hoffmann
2018-04-27 10:20 ` [Qemu-devel] [PULL 2/3] Fix libusb-1.0.22 deprecated libusb_set_debug with libusb_set_option Gerd Hoffmann
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2018-04-27 10:20 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, Jason Andryuk, qemu-stable
From: Jason Andryuk <jandryuk@gmail.com>
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.
Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
Message-id: 20180420183219.20722-1-jandryuk@gmail.com
Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/dev-smartcard-reader.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c
index e6468057a0..cabb564788 100644
--- a/hw/usb/dev-smartcard-reader.c
+++ b/hw/usb/dev-smartcard-reader.c
@@ -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; */
--
2.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 2/3] Fix libusb-1.0.22 deprecated libusb_set_debug with libusb_set_option
2018-04-27 10:20 [Qemu-devel] [PULL 0/3] Usb 20180427 patches Gerd Hoffmann
2018-04-27 10:20 ` [Qemu-devel] [PULL 1/3] ccid: Fix dwProtocols advertisement of T=0 Gerd Hoffmann
@ 2018-04-27 10:20 ` Gerd Hoffmann
2018-06-01 20:07 ` Philippe Mathieu-Daudé
2018-04-27 10:20 ` [Qemu-devel] [PULL 3/3] ccid-card: include libcacard.h only Gerd Hoffmann
2018-04-27 12:30 ` [Qemu-devel] [PULL 0/3] Usb 20180427 patches Peter Maydell
3 siblings, 1 reply; 6+ messages in thread
From: Gerd Hoffmann @ 2018-04-27 10:20 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, John Thomson
From: John Thomson <git@johnthomson.fastmail.com.au>
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'
Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
Message-id: 20180405132046.4968-1-git@johnthomson.fastmail.com.au
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/host-libusb.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 1b0be071cc..dc0a8fe295 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -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
--
2.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL 2/3] Fix libusb-1.0.22 deprecated libusb_set_debug with libusb_set_option
2018-04-27 10:20 ` [Qemu-devel] [PULL 2/3] Fix libusb-1.0.22 deprecated libusb_set_debug with libusb_set_option Gerd Hoffmann
@ 2018-06-01 20:07 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-06-01 20:07 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, John Thomson, qemu-stable
Cc'ing qemu-stable since I can not build it without this patch
cherry-picked.
On 04/27/2018 07:20 AM, Gerd Hoffmann wrote:
> From: John Thomson <git@johnthomson.fastmail.com.au>
>
> 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'
>
> Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
> Message-id: 20180405132046.4968-1-git@johnthomson.fastmail.com.au
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> hw/usb/host-libusb.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
> index 1b0be071cc..dc0a8fe295 100644
> --- a/hw/usb/host-libusb.c
> +++ b/hw/usb/host-libusb.c
> @@ -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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 3/3] ccid-card: include libcacard.h only
2018-04-27 10:20 [Qemu-devel] [PULL 0/3] Usb 20180427 patches Gerd Hoffmann
2018-04-27 10:20 ` [Qemu-devel] [PULL 1/3] ccid: Fix dwProtocols advertisement of T=0 Gerd Hoffmann
2018-04-27 10:20 ` [Qemu-devel] [PULL 2/3] Fix libusb-1.0.22 deprecated libusb_set_debug with libusb_set_option Gerd Hoffmann
@ 2018-04-27 10:20 ` Gerd Hoffmann
2018-04-27 12:30 ` [Qemu-devel] [PULL 0/3] Usb 20180427 patches Peter Maydell
3 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2018-04-27 10:20 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, Michal Privoznik
From: Michal Privoznik <mprivozn@redhat.com>
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.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 3c36db1dc0702763ebb7966cc27428ed67d43804.1522751624.git.mprivozn@redhat.com
[ kraxel: fix include path ]
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
configure | 2 +-
hw/usb/ccid-card-emulated.c | 5 +----
hw/usb/ccid-card-passthru.c | 2 +-
3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/configure b/configure
index 0a19b033bc..0a4f0da58f 100755
--- a/configure
+++ b/configure
@@ -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"
diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c
index ea42e4681d..5c8b3c9907 100644
--- a/hw/usb/ccid-card-emulated.c
+++ b/hw/usb/ccid-card-emulated.c
@@ -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"
diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
index b7dd3602dc..7684db0cb3 100644
--- a/hw/usb/ccid-card-passthru.c
+++ b/hw/usb/ccid-card-passthru.c
@@ -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"
--
2.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL 0/3] Usb 20180427 patches
2018-04-27 10:20 [Qemu-devel] [PULL 0/3] Usb 20180427 patches Gerd Hoffmann
` (2 preceding siblings ...)
2018-04-27 10:20 ` [Qemu-devel] [PULL 3/3] ccid-card: include libcacard.h only Gerd Hoffmann
@ 2018-04-27 12:30 ` Peter Maydell
3 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2018-04-27 12:30 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: QEMU Developers
On 27 April 2018 at 11:20, Gerd Hoffmann <kraxel@redhat.com> wrote:
> 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.
>
> ----------------------------------------------------------------
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread