* is just a wrong function name of libusb_get_port_number? request for a review of the bug fix
@ 2020-04-02 11:47 bauerchen(陈蒙蒙)
2020-04-03 6:50 ` kraxel
0 siblings, 1 reply; 5+ messages in thread
From: bauerchen(陈蒙蒙) @ 2020-04-02 11:47 UTC (permalink / raw)
To: qemu-devel; +Cc: hdegoede, kraxel
From 6bfb3087866606ed36a21e7bd05f0674e6a97158 Mon Sep 17 00:00:00 2001
From: Bauerchen <bauerchen@tencent.com>
Date: Thu, 2 Apr 2020 19:19:00 +0800
Subject: [PATCH] Fix:fix the wrong function name of libusb_get_port_number
[desc]:
libusb_get_port_numbers is called in function
usb_host_get_port, and qemu crashed with:
symbol lookup error: undefined symbol: libusb_get_port_numbers
I check /lib64/libusb-1.0.so.0 and output is libusb_get_port_number, I
change it to libusb_get_port_number, crash problem is gone;
so is it just a function name bug?
Signed-off-by: Bauerchen <bauerchen@tencent.com>
---
hw/usb/host-libusb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 2ac7a93..713db8d 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -285,7 +285,7 @@ static int usb_host_get_port(libusb_device *dev, char *port, size_t len)
int rc, i;
#if LIBUSB_API_VERSION >= 0x01000102
- rc = libusb_get_port_numbers(dev, path, 7);
+ rc = libusb_get_port_number(dev, path, 7);
#else
rc = libusb_get_port_path(ctx, dev, path, 7);
#endif
--
1.8.3.1
-------------
bauerchen
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: is just a wrong function name of libusb_get_port_number? request for a review of the bug fix
2020-04-02 11:47 is just a wrong function name of libusb_get_port_number? request for a review of the bug fix bauerchen(陈蒙蒙)
@ 2020-04-03 6:50 ` kraxel
2020-04-03 7:05 ` Re: is just a wrong function name of libusb_get_port_number? request for a review of the bug fix(Internet mail) bauerchen(陈蒙蒙)
0 siblings, 1 reply; 5+ messages in thread
From: kraxel @ 2020-04-03 6:50 UTC (permalink / raw)
To: bauerchen(陈蒙蒙); +Cc: hdegoede, qemu-devel
On Thu, Apr 02, 2020 at 11:47:17AM +0000, bauerchen(陈蒙蒙) wrote:
> From 6bfb3087866606ed36a21e7bd05f0674e6a97158 Mon Sep 17 00:00:00 2001
> From: Bauerchen <bauerchen@tencent.com>
> Date: Thu, 2 Apr 2020 19:19:00 +0800
> Subject: [PATCH] Fix:fix the wrong function name of libusb_get_port_number
>
> [desc]:
> libusb_get_port_numbers is called in function
> usb_host_get_port, and qemu crashed with:
> symbol lookup error: undefined symbol: libusb_get_port_numbers
> I check /lib64/libusb-1.0.so.0 and output is libusb_get_port_number, I
> change it to libusb_get_port_number, crash problem is gone;
> so is it just a function name bug?
>
> Signed-off-by: Bauerchen <bauerchen@tencent.com>
> ---
> hw/usb/host-libusb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
> index 2ac7a93..713db8d 100644
> --- a/hw/usb/host-libusb.c
> +++ b/hw/usb/host-libusb.c
> @@ -285,7 +285,7 @@ static int usb_host_get_port(libusb_device *dev, char *port, size_t len)
> int rc, i;
>
> #if LIBUSB_API_VERSION >= 0x01000102
> - rc = libusb_get_port_numbers(dev, path, 7);
> + rc = libusb_get_port_number(dev, path, 7);
Surely not that simple. libusb_get_port_number isn't a drop-in
replacement for libusb_get_port_numbers. Also it was probably added
later to libusb, so some LIBUSB_API_VERSION #ifdef will be needed so the
one or the other will be used depending on the library version.
cheers,
Gerd
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: is just a wrong function name of libusb_get_port_number? request for a review of the bug fix(Internet mail)
2020-04-03 6:50 ` kraxel
@ 2020-04-03 7:05 ` bauerchen(陈蒙蒙)
2020-04-03 8:19 ` kraxel
0 siblings, 1 reply; 5+ messages in thread
From: bauerchen(陈蒙蒙) @ 2020-04-03 7:05 UTC (permalink / raw)
To: kraxel; +Cc: hdegoede, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 2190 bytes --]
thanks, but my libusbx version is libusbx-1.0.15-4.el7.x86_64 ,
I can find libusb_get_port_numbers function in libusb-1.0.so.0 but find libusb_get_port_number
[root@t]# strings /lib64/libusb-1.0.so.0 |grep libusb_get_port_number
libusb_get_port_number
[root@t]#
is my libusbx package problem?
________________________________
Bauer
From: kraxel<mailto:kraxel@redhat.com>
Date: 2020-04-03 14:50
To: bauerchen(陈蒙蒙)<mailto:bauerchen@tencent.com>
CC: qemu-devel<mailto:qemu-devel@nongnu.org>; hdegoede<mailto:hdegoede@redhat.com>
Subject: Re: is just a wrong function name of libusb_get_port_number? request for a review of the bug fix(Internet mail)
On Thu, Apr 02, 2020 at 11:47:17AM +0000, bauerchen(陈蒙蒙) wrote:
> From 6bfb3087866606ed36a21e7bd05f0674e6a97158 Mon Sep 17 00:00:00 2001
> From: Bauerchen <bauerchen@tencent.com>
> Date: Thu, 2 Apr 2020 19:19:00 +0800
> Subject: [PATCH] Fix:fix the wrong function name of libusb_get_port_number
>
> [desc]:
> libusb_get_port_numbers is called in function
> usb_host_get_port, and qemu crashed with:
> symbol lookup error: undefined symbol: libusb_get_port_numbers
> I check /lib64/libusb-1.0.so.0 and output is libusb_get_port_number, I
> change it to libusb_get_port_number, crash problem is gone;
> so is it just a function name bug?
>
> Signed-off-by: Bauerchen <bauerchen@tencent.com>
> ---
> hw/usb/host-libusb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
> index 2ac7a93..713db8d 100644
> --- a/hw/usb/host-libusb.c
> +++ b/hw/usb/host-libusb.c
> @@ -285,7 +285,7 @@ static int usb_host_get_port(libusb_device *dev, char *port, size_t len)
> int rc, i;
>
> #if LIBUSB_API_VERSION >= 0x01000102
> - rc = libusb_get_port_numbers(dev, path, 7);
> + rc = libusb_get_port_number(dev, path, 7);
Surely not that simple. libusb_get_port_number isn't a drop-in
replacement for libusb_get_port_numbers. Also it was probably added
later to libusb, so some LIBUSB_API_VERSION #ifdef will be needed so the
one or the other will be used depending on the library version.
cheers,
Gerd
[-- Attachment #2: Type: text/html, Size: 4174 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: is just a wrong function name of libusb_get_port_number? request for a review of the bug fix(Internet mail)
2020-04-03 7:05 ` Re: is just a wrong function name of libusb_get_port_number? request for a review of the bug fix(Internet mail) bauerchen(陈蒙蒙)
@ 2020-04-03 8:19 ` kraxel
2020-04-03 8:50 ` bauerchen(陈蒙蒙)
0 siblings, 1 reply; 5+ messages in thread
From: kraxel @ 2020-04-03 8:19 UTC (permalink / raw)
To: bauerchen(陈蒙蒙); +Cc: hdegoede, qemu-devel
On Fri, Apr 03, 2020 at 07:05:13AM +0000, bauerchen(陈蒙蒙) wrote:
> thanks, but my libusbx version is libusbx-1.0.15-4.el7.x86_64 ,
> I can find libusb_get_port_numbers function in libusb-1.0.so.0 but find libusb_get_port_number
>
> [root@t]# strings /lib64/libusb-1.0.so.0 |grep libusb_get_port_number
> libusb_get_port_number
> [root@t]#
kraxel@sirius ~# grep libusb_get_port_number /usr/include/libusb-1.0/libusb.h
uint8_t LIBUSB_CALL libusb_get_port_number(libusb_device *dev);
int LIBUSB_CALL libusb_get_port_numbers(libusb_device *dev, uint8_t* port_numbers, int port_numbers_len);
LIBUSB_DEPRECATED_FOR(libusb_get_port_numbers)
So libusb_get_port_numbers replaces libusb_get_port_number, seems you have an
old version which hasn't yet libusb_get_port_numbers.
On old version qemu should fallback to libusb_get_port_path, but maybe the
version #ifdef is wrong so this doesn't work properly for some versions ...
According to my /usr/include/libusb-1.0/libusb.h libusb >= 1.0.16 declares
LIBUSB_API_VERSION >= 0x01000102, so that looks ok. Hmm, not sure what is
going on here. In any case the libusb_get_port_path fallback code path
should work.
cheers,
Gerd
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: is just a wrong function name of libusb_get_port_number? request for a review of the bug fix(Internet mail)
2020-04-03 8:19 ` kraxel
@ 2020-04-03 8:50 ` bauerchen(陈蒙蒙)
0 siblings, 0 replies; 5+ messages in thread
From: bauerchen(陈蒙蒙) @ 2020-04-03 8:50 UTC (permalink / raw)
To: kraxel; +Cc: hdegoede, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1605 bytes --]
OK,thanks, I will try .
________________________________
Bauer
From: kraxel<mailto:kraxel@redhat.com>
Date: 2020-04-03 16:19
To: bauerchen(陈蒙蒙)<mailto:bauerchen@tencent.com>
CC: qemu-devel<mailto:qemu-devel@nongnu.org>; hdegoede<mailto:hdegoede@redhat.com>
Subject: Re: is just a wrong function name of libusb_get_port_number? request for a review of the bug fix(Internet mail)
On Fri, Apr 03, 2020 at 07:05:13AM +0000, bauerchen(陈蒙蒙) wrote:
> thanks, but my libusbx version is libusbx-1.0.15-4.el7.x86_64 ,
> I can find libusb_get_port_numbers function in libusb-1.0.so.0 but find libusb_get_port_number
>
> [root@t]# strings /lib64/libusb-1.0.so.0 |grep libusb_get_port_number
> libusb_get_port_number
> [root@t]#
kraxel@sirius ~# grep libusb_get_port_number /usr/include/libusb-1.0/libusb.h
uint8_t LIBUSB_CALL libusb_get_port_number(libusb_device *dev);
int LIBUSB_CALL libusb_get_port_numbers(libusb_device *dev, uint8_t* port_numbers, int port_numbers_len);
LIBUSB_DEPRECATED_FOR(libusb_get_port_numbers)
So libusb_get_port_numbers replaces libusb_get_port_number, seems you have an
old version which hasn't yet libusb_get_port_numbers.
On old version qemu should fallback to libusb_get_port_path, but maybe the
version #ifdef is wrong so this doesn't work properly for some versions ...
According to my /usr/include/libusb-1.0/libusb.h libusb >= 1.0.16 declares
LIBUSB_API_VERSION >= 0x01000102, so that looks ok. Hmm, not sure what is
going on here. In any case the libusb_get_port_path fallback code path
should work.
cheers,
Gerd
[-- Attachment #2: Type: text/html, Size: 3008 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-04-03 9:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-02 11:47 is just a wrong function name of libusb_get_port_number? request for a review of the bug fix bauerchen(陈蒙蒙)
2020-04-03 6:50 ` kraxel
2020-04-03 7:05 ` Re: is just a wrong function name of libusb_get_port_number? request for a review of the bug fix(Internet mail) bauerchen(陈蒙蒙)
2020-04-03 8:19 ` kraxel
2020-04-03 8:50 ` bauerchen(陈蒙蒙)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).