Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libusb error (invalid it is an issue with airspy linux kernel driver) #27

Closed
dgorissen opened this issue Oct 22, 2015 · 11 comments
Closed

libusb error (invalid it is an issue with airspy linux kernel driver) #27

dgorissen opened this issue Oct 22, 2015 · 11 comments
Labels

Comments

@dgorissen
Copy link

@dgorissen dgorissen commented Oct 22, 2015

Im running on ubuntu vivid with a fresh clone & install of the airspy repo (including PR #19 which I understand should make things work out of the box with newer kernels).

However I am unable to connect and unsure how to debug further. See output below.

dgorissen@minion:~$ uname -a
Linux minion 3.19.0-30-generic #34-Ubuntu SMP Fri Oct 2 22:08:41 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

dmesg output:
[ 2000.375749] usb 1-2: new high-speed USB device number 5 using xhci_hcd
[ 2000.610160] usb 1-2: New USB device found, idVendor=1d50, idProduct=60a1
[ 2000.610164] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2000.610165] usb 1-2: Product: AIRSPY
[ 2000.610167] usb 1-2: Manufacturer: www.airspy.com
[ 2000.610168] usb 1-2: SerialNumber: AIRSPY SN:466C64C82C1073C7
[ 2000.641372] airspy 1-2:1.0: usb_control_msg() failed -32 request 0a
[ 2000.641375] airspy 1-2:1.0: Could not detect board
[ 2000.641380] airspy: probe of 1-2:1.0 failed with error -32

dgorissen@minion:~$ airspy_info
airspy_lib_version: 1.0.6

Found AirSpy board 1
Board ID Number: 0 (AIRSPY)
Firmware Version: AirSpy NOS v1.0.0-rc5-0-g648c14f 2015-05-20
Part ID Number: 0x6906002B 0x00000030
Serial Number: 0x466C64C82C1073C7
Supported sample rates:
10.000000 MSPS
2.500000 MSPS
Close board 1
airspy_close() board 1 failed: AIRSPY_ERROR_LIBUSB (-1000)

@dgorissen
Copy link
Author

@dgorissen dgorissen commented Oct 22, 2015

PS: just to add that it works fine with the windows VM I have on the same machine. So its definitely not a hardware issue. Have also updated the firmware to rc6 but no improvement (if anything its worse as airspy_info fails directly with the libusb error without printing any info first)

@ghost
Copy link

@ghost ghost commented Oct 22, 2015

Your kernel version is greater than 3.17 have you blacklisted the Linux kernel Airspy driver ?
See "Kernel >= 3.17 problems" https://github.com/airspy/host/wiki/Troubleshooting#linux-debianubuntu

You will not be able to update the firmware correctly either unless it is blacklisted.

@dgorissen
Copy link
Author

@dgorissen dgorissen commented Oct 22, 2015

Blacklisting has seemed to solve it. Doh! Thanks.

@dgorissen dgorissen closed this Oct 22, 2015
@ghost
Copy link

@ghost ghost commented Oct 22, 2015

Sorry I did not realised that the "libusb_detach_kernel_driver for Linux Kernel" was added to the master branch.

@bvernoux
Copy link
Member

@bvernoux bvernoux commented Oct 22, 2015

I have updated libairspy version to 1.0.7 in order to be sure we use the feature "libusb_detach_kernel_driver for Linux Kernel" and also other feature introduced after 1.0.6
Could you try again without blacklisting kernel module ? (you shall git clone the repository master to be sure you have all the latest fix/enhancement, but to be sure now airspy_info will display version 1.0.7)
As this version shall fix the problem.

@dgorissen
Copy link
Author

@dgorissen dgorissen commented Oct 22, 2015

Unfortunately it does not seem fixed (enabling the blacklist fixes things again)

dgorissen@minion:~/host.orig/build$ airspy_info
airspy_lib_version: 1.0.7

Found AirSpy board 1
Board ID Number: 0 (AIRSPY)
Firmware Version: AirSpy NOS v1.0.0-rc6-0-g035ff81 2015-07-14
airspy_board_partid_serialno_read() failed: AIRSPY_ERROR_LIBUSB (-1000)

@dgorissen dgorissen reopened this Oct 22, 2015
@bvernoux bvernoux added the bug label Oct 23, 2015
@bvernoux bvernoux added this to the 1.0.7 milestone Oct 23, 2015
@bvernoux
Copy link
Member

@bvernoux bvernoux commented Oct 24, 2015

Could you apply this patch
https://gist.github.com/bvernoux/7175fad615c290391ffb
On latest source code 4a1c734

  • Then send attach the log when calling airspy_info
    • And also tell me if that fix the problem
@dgorissen
Copy link
Author

@dgorissen dgorissen commented Oct 24, 2015

Running as root makes no difference. Applied patch, log below.

dgorissen@minion:~/host.orig/build$ airspy_info
airspy_lib_version: 1.0.7

[timestamp] [threadID] facility level [function call]

[ 0.000680] [00005696] libusb: debug [libusb_kernel_driver_active] interface 0
libusb_kernel_driver_active() res=0
[ 0.011624] [00005696] libusb: debug [libusb_detach_kernel_driver] interface 0
libusb_detach_kernel_driver() res=-5
[ 0.011681] [00005696] libusb: debug [libusb_set_configuration] configuration 1
[ 0.011754] [00005697] libusb: debug [linux_udev_event_thread_main] udev event thread entering.
[ 0.050202] [00005696] libusb: debug [libusb_claim_interface] interface 0
[ 0.050370] [00005696] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.050465] [00005696] libusb: debug [handle_events] poll() 4 fds with timeout in 60000ms
[ 0.050713] [00005696] libusb: debug [handle_events] poll() returned 1
[ 0.050769] [00005696] libusb: debug [reap_for_handle] urb type=2 status=0 transferred=1
[ 0.050795] [00005696] libusb: debug [handle_control_completion] handling completion status 0
[ 0.050819] [00005696] libusb: debug [disarm_timerfd]
[ 0.050831] [00005696] libusb: debug [usbi_handle_transfer_completion] transfer 0x111b110 has callback 0x7fcba0e130b0
[ 0.050854] [00005696] libusb: debug [sync_transfer_cb] actual_length=1
[ 0.051803] [00005696] libusb: debug [libusb_init] libusb v1.0.19.10903
[ 0.051940] [00005696] libusb: debug [find_usbfs_path] found usbfs at /dev/bus/usb
[ 0.051981] [00005696] libusb: debug [op_init] bulk continuation flag supported
[ 0.052017] [00005696] libusb: debug [op_init] zero length packet flag supported
[ 0.052062] [00005696] libusb: debug [op_init] sysfs can relate devices
[ 0.052098] [00005696] libusb: debug [op_init] sysfs has complete descriptors
[ 0.052345] [00005696] libusb: debug [linux_get_device_address] getting address for device: usb1 detached: 0
[ 0.057135] [00005696] libusb: debug [linux_get_device_address] scan usb1
[ 0.057323] [00005696] libusb: debug [linux_get_device_address] bus=1 dev=1
[ 0.057410] [00005696] libusb: debug [linux_enumerate_device] busnum 1 devaddr 1 session_id 257
[ 0.057477] [00005696] libusb: debug [linux_enumerate_device] allocating new device for 1/1 (session 257)
[ 0.057779] [00005696] libusb: debug [linux_get_device_address] getting address for device: 1-1 detached: 0
[ 0.057865] [00005696] libusb: debug [linux_get_device_address] scan 1-1
[ 0.057973] [00005696] libusb: debug [linux_get_device_address] bus=1 dev=2
[ 0.058071] [00005696] libusb: debug [linux_enumerate_device] busnum 1 devaddr 2 session_id 258
[ 0.058179] [00005696] libusb: debug [linux_enumerate_device] allocating new device for 1/2 (session 258)
[ 0.058419] [00005696] libusb: debug [linux_get_parent_info] Dev 0x111e160 (1-1) has parent 0x111e0a0 (usb1) port 1
[ 0.066897] [00005696] libusb: debug [linux_get_device_address] getting address for device: 1-2 detached: 0
[ 0.066910] [00005696] libusb: debug [linux_get_device_address] scan 1-2
[ 0.067019] [00005696] libusb: debug [linux_get_device_address] bus=1 dev=6
[ 0.067198] [00005696] libusb: debug [linux_enumerate_device] busnum 1 devaddr 6 session_id 262
[ 0.067210] [00005696] libusb: debug [linux_enumerate_device] allocating new device for 1/6 (session 262)
[ 0.067285] [00005696] libusb: debug [linux_get_parent_info] Dev 0x111e220 (1-2) has parent 0x111e0a0 (usb1) port 2
[ 0.067385] [00005696] libusb: debug [linux_get_device_address] getting address for device: usb2 detached: 0
[ 0.067398] [00005696] libusb: debug [linux_get_device_address] scan usb2
[ 0.067452] [00005696] libusb: debug [linux_get_device_address] bus=2 dev=1
[ 0.067464] [00005696] libusb: debug [linux_enumerate_device] busnum 2 devaddr 1 session_id 513
[ 0.067472] [00005696] libusb: debug [linux_enumerate_device] allocating new device for 2/1 (session 513)
[ 0.067567] [00005696] libusb: debug [usbi_add_pollfd] add fd 12 events 1
[ 0.067581] [00005696] libusb: debug [usbi_add_pollfd] add fd 14 events 1
[ 0.067590] [00005696] libusb: debug [usbi_io_init] using timerfd for timeouts
[ 0.067596] [00005696] libusb: debug [usbi_add_pollfd] add fd 16 events 1
[ 0.067604] [00005696] libusb: debug [libusb_get_device_list]
[ 0.067616] [00005696] libusb: debug [libusb_get_device_descriptor]
[ 0.067623] [00005696] libusb: debug [libusb_get_device_descriptor]
[ 0.067629] [00005696] libusb: debug [libusb_open] open 1.6
[ 0.067650] [00005696] libusb: debug [usbi_add_pollfd] add fd 17 events 4
[ 0.067661] [00005696] libusb: debug [libusb_kernel_driver_active] interface 0
libusb_kernel_driver_active() res=0
[ 0.067676] [00005696] libusb: debug [libusb_detach_kernel_driver] interface 0
libusb_detach_kernel_driver() res=-5
[ 0.067689] [00005696] libusb: debug [libusb_set_configuration] configuration 1
[ 0.067709] [00005696] libusb: debug [libusb_close]
[ 0.067718] [00005696] libusb: debug [usbi_remove_pollfd] remove fd 17
[ 0.067728] [00005696] libusb: debug [libusb_get_device_descriptor]
[ 0.067735] [00005696] libusb: debug [libusb_get_device_descriptor]
[ 0.067743] [00005696] libusb: debug [libusb_exit]
[ 0.067750] [00005696] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.067757] [00005696] libusb: debug [handle_events] poll() 3 fds with timeout in 0ms
[ 0.067766] [00005696] libusb: debug [handle_events] poll() returned 0
[ 0.067773] [00005696] libusb: debug [libusb_unref_device] destroy device 2.1
[ 0.067780] [00005696] libusb: debug [libusb_unref_device] destroy device 1.6
[ 0.067787] [00005696] libusb: debug [libusb_unref_device] destroy device 1.2
[ 0.067794] [00005696] libusb: debug [libusb_unref_device] destroy device 1.1
[ 0.067800] [00005696] libusb: debug [usbi_remove_pollfd] remove fd 12
[ 0.067820] [00005696] libusb: debug [usbi_remove_pollfd] remove fd 14
[ 0.067828] [00005696] libusb: debug [usbi_remove_pollfd] remove fd 16

Found AirSpy board 1
[ 0.067894] [00005696] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.069177] [00005696] libusb: debug [handle_events] poll() 4 fds with timeout in 60000ms
[ 0.069233] [00005696] libusb: debug [handle_events] poll() returned 1
[ 0.069270] [00005696] libusb: debug [reap_for_handle] urb type=2 status=0 transferred=1
[ 0.069306] [00005696] libusb: debug [handle_control_completion] handling completion status 0
[ 0.069341] [00005696] libusb: debug [disarm_timerfd]
[ 0.072495] [00005696] libusb: debug [usbi_handle_transfer_completion] transfer 0x111ed90 has callback 0x7fcba0e130b0
[ 0.072533] [00005696] libusb: debug [sync_transfer_cb] actual_length=1
Board ID Number: 0 (AIRSPY)
[ 0.072643] [00005696] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.072763] [00005696] libusb: debug [handle_events] poll() 4 fds with timeout in 60000ms
[ 0.072921] [00005696] libusb: debug [handle_events] poll() returned 1
[ 0.072991] [00005696] libusb: debug [reap_for_handle] urb type=2 status=0 transferred=44
[ 0.073032] [00005696] libusb: debug [handle_control_completion] handling completion status 0
[ 0.073058] [00005696] libusb: debug [disarm_timerfd]
[ 0.073082] [00005696] libusb: debug [usbi_handle_transfer_completion] transfer 0x111ed90 has callback 0x7fcba0e130b0
[ 0.073091] [00005696] libusb: debug [sync_transfer_cb] actual_length=44
Firmware Version: AirSpy NOS v1.0.0-rc6-0-g035ff81 2015-07-14
[ 0.073144] [00005696] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.073230] [00005696] libusb: debug [handle_events] poll() 4 fds with timeout in 60000ms
[ 6.689042] [00005696] libusb: debug [handle_events] poll() returned 1
[ 6.689078] [00005696] libusb: debug [reap_for_handle] urb type=2 status=-32 transferred=0
[ 6.689135] [00005696] libusb: debug [handle_control_completion] handling completion status -32
[ 6.689141] [00005696] libusb: debug [handle_control_completion] unsupported control request
[ 6.689146] [00005696] libusb: debug [disarm_timerfd]
[ 6.689152] [00005696] libusb: debug [usbi_handle_transfer_completion] transfer 0x111ed90 has callback 0x7fcba0e130b0
[ 6.689156] [00005696] libusb: debug [sync_transfer_cb] actual_length=0
airspy_board_partid_serialno_read() failed: AIRSPY_ERROR_LIBUSB (-1000)

@bvernoux
Copy link
Member

@bvernoux bvernoux commented Oct 25, 2015

Thanks for the feedback so the problem is confirmed
libusb_kernel_driver_active() res=0 => No airspy kernel driver detected why ?
libusb_detach_kernel_driver() res=-5 => LIBUSB_ERROR_NOT_FOUND = -5 (probably because No airspy kernel driver detected)
For me it seems to be a bug with libusb with your kernel airspy module loaded which is not detected so it cannot be unloaded.
We will need to check with libusb developer why such error happen with your system

@bvernoux
Copy link
Member

@bvernoux bvernoux commented Oct 26, 2015

Thanks to Antti for his quick fix see
http://git.linuxtv.org/cgit.cgi/anttip/media_tree.git/commit/?h=airspy&id=a4db80b38a537bb58b73a634238d7519c0f57e2a
So old driver and actual ones (until version is compliant with "AirSpy v1.0") will do not match version string required by kernel driver and so the kernel driver will exit and we will do not need to blacklist the airspy kernel driver.

@bvernoux bvernoux removed this from the 1.0.7 milestone Nov 14, 2015
@bvernoux bvernoux added invalid and removed bug labels Nov 23, 2015
@bvernoux bvernoux changed the title libusb error libusb error (invalid it is an issue with airspy linux kernel driver) Nov 23, 2015
torvalds pushed a commit to torvalds/linux that referenced this issue Dec 18, 2015
Driver requested device firmware version string during probe using
only 24 byte long buffer. That buffer is too small for newer firmware
versions, which causes device firmware hang - device stops responding
to any commands after that. Increase buffer size to 128 which should
be enough for any current and future version strings.

Link: airspy/airspyone_host#27

Cc: <stable@vger.kernel.org> # 3.17+
Reported-by: Benjamin Vernoux <bvernoux@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
@bvernoux
Copy link
Member

@bvernoux bvernoux commented Dec 23, 2015

So this problem shall be fixed with linux kernel v4.4-rc6
Does anyone can test and confirm all work fine ?

umakrishn added a commit to surelock/linux that referenced this issue Jan 12, 2016
Driver requested device firmware version string during probe using
only 24 byte long buffer. That buffer is too small for newer firmware
versions, which causes device firmware hang - device stops responding
to any commands after that. Increase buffer size to 128 which should
be enough for any current and future version strings.

Link: airspy/airspyone_host#27

Cc: <stable@vger.kernel.org> # 3.17+
Reported-by: Benjamin Vernoux <bvernoux@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
woodsts pushed a commit to woodsts/linux-stable that referenced this issue Jan 31, 2016
commit aa0850e upstream.

Driver requested device firmware version string during probe using
only 24 byte long buffer. That buffer is too small for newer firmware
versions, which causes device firmware hang - device stops responding
to any commands after that. Increase buffer size to 128 which should
be enough for any current and future version strings.

Link: airspy/airspyone_host#27

Reported-by: Benjamin Vernoux <bvernoux@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
woodsts pushed a commit to woodsts/linux-stable that referenced this issue Jan 31, 2016
commit aa0850e upstream.

Driver requested device firmware version string during probe using
only 24 byte long buffer. That buffer is too small for newer firmware
versions, which causes device firmware hang - device stops responding
to any commands after that. Increase buffer size to 128 which should
be enough for any current and future version strings.

Link: airspy/airspyone_host#27

Reported-by: Benjamin Vernoux <bvernoux@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mschlaeffer pushed a commit to mschlaeffer/ubuntu-kernel-with-tuxonice that referenced this issue Feb 23, 2016
BugLink: http://bugs.launchpad.net/bugs/1536370

commit aa0850e upstream.

Driver requested device firmware version string during probe using
only 24 byte long buffer. That buffer is too small for newer firmware
versions, which causes device firmware hang - device stops responding
to any commands after that. Increase buffer size to 128 which should
be enough for any current and future version strings.

Link: airspy/airspyone_host#27

Reported-by: Benjamin Vernoux <bvernoux@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
atull-altera pushed a commit to altera-opensource/linux-socfpga that referenced this issue Apr 14, 2016
commit aa0850e upstream.

Driver requested device firmware version string during probe using
only 24 byte long buffer. That buffer is too small for newer firmware
versions, which causes device firmware hang - device stops responding
to any commands after that. Increase buffer size to 128 which should
be enough for any current and future version strings.

Link: airspy/airspyone_host#27

Reported-by: Benjamin Vernoux <bvernoux@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
@bvernoux bvernoux modified the milestone: 1.0.8 Apr 22, 2016
@bvernoux bvernoux closed this Oct 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants