bluekitchen / btstack

Dual-mode Bluetooth stack, with small memory footprint.
http://bluekitchen-gmbh.com
Other
1.74k stars 613 forks source link

Not possible to set TTY & logfile path for examples with '--address' program option #504

Open fominykhandrei opened 1 year ago

fominykhandrei commented 1 year ago

Describe the bug It 's not possible to set one of the common program option ('ulrh?') together with "--address" for some examples. E.g for le_streamer_client it's not possible to set TTY port together with GATT server address:

$ ./le_streamer_client -u /dev/ttyUSB1 --address 6C:1D:EB:90:C8:D4
./le_streamer_client: unrecognized option '--address'
Packet Log: /tmp/hci_dump.pklg
H4 device: /dev/ttyUSB1
Usage: ./le_streamer_client [-a|--address aa:bb:cc:dd:ee:ff]
If no argument is provided, LE Streamer Client will start scanning and connect to the first device named 'LE Streamer'.
To connect to a specific device use argument [-a].

^CCTRL-C - SIGINT received, shutting down..

If TTY is provided AFTER address, then it is also ignored

$ ./le_streamer_client --address 6C:1D:EB:90:C8:D4 -u /dev/ttyUSB1
./le_streamer_client: unrecognized option '--address'
Packet Log: /tmp/hci_dump.pklg
H4 device: /dev/tty.usbmodemEF437DF524C51
Usage: ./le_streamer_client [-a|--address aa:bb:cc:dd:ee:ff]
If no argument is provided, LE Streamer Client will start scanning and connect to the first device named 'LE Streamer'.
To connect to a specific device use argument [-a].

To Reproduce

Steps to reproduce the behavior:

  1. Linux host build, POSIX-H4 port
  2. Run example
    $ ./gatt_battery_query -u /dev/ttyUSB1 --address 6C:1D:EB:90:C8:D4

Expected behavior

It should be possible to specify GATT server address

HCI Packet Logs For all Bluetooth issues, please provide a full packet log that includes initial pairing. You need to zip the packet log as GitHub does not know how to handle .pklg files.

Environment: (please complete the following information):

mringwal commented 1 year ago

Good point. Could you try the version on develop-getopt-libusb branch? It updates the command line argument handling code for libusb and posix-h4 ports