greatscottgadgets / hackrf

low cost software radio platform
https://greatscottgadgets.com/hackrf/
GNU General Public License v2.0
6.58k stars 1.53k forks source link

multi-device support #87

Closed mossmann closed 9 years ago

mossmann commented 11 years ago

libhackrf and hackrf-tools should support multiple HackRF devices connected over USB. It should be possible to select a particular device for a given operation. It should be straightforward to use two HackRF devices together for full-duplex operation.

scateu commented 10 years ago

does it be supported yet?

scateu commented 10 years ago

Here's a tricky method about duplex.

If you plug in two hackrf device, hackrf_info will only show one hackrf device.

But, if you plug in one first, run something with this hackrf to occupy it. Then plug in another hackrf device, then run another program , and the 'duplex' works.

jboone commented 10 years ago

I bodged up reporting the LPC43xx serial number (128 bits) via the USB serial number descriptor. That firmware code is somewhat respectable. I also have some crude and half-baked support in libhackrf and hackrf_transfer. I will work on improving it when I have time, or I can share it with somebody who wants to clean it up and put it to bed.

scateu commented 10 years ago

hi jboone, maybe I have time to test and clean it. Could you please give me a github address to pull?

sharebrained commented 10 years ago

On May 15, 2014, at 9:59, scateu notifications@github.com wrote:

hi jboone, maybe I have time to test and clean it. Could you please give me a github address to pull?

Sure. I committed it on a branch:

https://github.com/mossmann/hackrf/tree/serial_number

The commit log has a list of things I know need to be done to make an acceptable patch:

Among the TODOs:

  • Refactor obtaining LPC serial number and chip ID (appears in usb_api_board_info.c/h) into separate, common API and header/source files. Remove from main().
  • Create a usb_set_serial_number_descriptor() or similar function to be called before USB stack is started.
  • Ensure USB serial number descriptor is valid even if code forgets to initialize the serial number before the USB stack is started. May be as simple as providing default initializer for usb_descriptor_string_serial_number[].
  • Create a #define/constant for the usb_descriptor_string_serial_number length.
  • Identify what's causing intermittent crashes in hackrf_transfer when no serial number is specified. I'm probably misusing getopt.
  • Permit serial number without leading zeros so you don't have to type as much.
  • Add support for serial number argument in other hackrf_* tools.
  • Provide libhackrf support for enumerating multiple HackRFs, so that hackrf_info can list all devices. May require an additional libhackrf function, outside of hackrf_open().

...and anything else that makes this less of a hack.

Thanks for your help!

- Jared
hessu commented 9 years ago

I grabbed Jared's branch and tried to polish it a bit. Feedback welcome in pull request #158.

hessu commented 9 years ago

@dominicgs merged pull request #158 yesterday, and multiple devices support is now in the git master branch. I'll submit the gr-osmosdr changes this weekend. They're now in my feature branch: https://github.com/hessu/gr-osmosdr/tree/feature/hackrf_multidev

dominicgs commented 9 years ago

This has been merged and in use for over a month now. I think we can close this issue.