Skip to content

Ubertooth Crashes After Trying to Hop Multiple Channels #537

@bm127127

Description

@bm127127

Steps to reproduce

  1. Run the C script I made in Debian Linux (no command line arguments needed)
  2. Wait around 10 minutes for it to scan
  3. You will see a bunch of libusb errors and USB errors

Expected behaviour

Tell us what you expect should happen

I expect advertisement packets to keep being printed as channel 37, 38, and 39 are hopped for 10 seconds each.

Actual behaviour

Tell us what happens instead

Advertisement packets are printed from each channel as expected, however, it stops after around 10 minutes and libusb timeout errors are printed instead.

Version information

Operating system:
I am using Debian 12 Linux Bookworm.

Ubertooth tools version (ubertooth-rx -V):

libubertooth 1.1 (2020-12-R1)

libbtbb version:

libbtbb 1.0, (2018-06-R1)

Ubertooth firmware version (ubertooth-util -v):

2020-12-R1 API: 1.07

If you are reporting a problem that involves third party software
(Wireshark/Kismet/etc), please report the version here.

Output

My script:

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <errno.h>

pid_t btworker;

// Function to gracefully exit the program when the signal handler is called
void cleanExit(){
    printf("Gracefully exiting bluetooth worker\n");
    if (kill(btworker, SIGINT) == 0) {
        printf("Killed btworker child process\n");
        waitpid(btworker, NULL, 0); // wait for child process to terminate
        sleep(2);
    } else {
        fprintf(stderr, "Could not kill child process\n");
    }
    exit(0);
}

int main() {
    int hop_period = 10;
    int channels[3] = {37, 38, 39};
    int curr_channel = 0;

    // infinintely loop btle scan
    while (1) {
        // creates new process to run btle scan
        btworker = fork();

        if (btworker < 0) {
            fprintf(stderr, "Could not fork\n");
        } else if (btworker == 0) {
            // execute ubertooth scan in child process
            char ad_channel[2];

            sprintf(ad_channel, "%d", channels[curr_channel]);
            execlp("stdbuf", "stdbuf", "-o0", "ubertooth-btle", "-n", "-A", ad_channel, (char *) NULL);
            // if this is reached execlp failed
            fprintf(stderr, "BTLE capture failed\n");
        } else {
            // rest of parent process code has to go here
            printf("Scanning for %d seconds on channel %d...\n", hop_period, channels[curr_channel]);
            sleep(hop_period);

            if (kill(btworker, SIGINT) == 0) {
                printf("Killed btworker child process\n");
                waitpid(btworker, NULL, 0); // wait for child process to terminate
                sleep(2);
            } else {
                fprintf(stderr, "Could not kill child process\n");
            }

            // update channel to scan next
            if (curr_channel == 2) {
                curr_channel = 0;
            } else {
                curr_channel += 1;
            }
        }
    }
}

The error message:

Scanning for 10 seconds on channel 37...
libUSB Error: Operation timed out (-7)
libUSB Error: Operation timed out (-7)
libUSB Error: Operation timed out (-7)
libUSB Error: Operation timed out (-7)
USB Error

The messages repeat forever while scanning is repeatedly attempted on each channel for 10 s.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions