mirror of
https://github.com/greatscottgadgets/ubertooth.git
synced 2026-10-12 02:15:11 +00:00
xmas: userspace plumbing
This commit is contained in:
@@ -722,6 +722,10 @@ static int vendor_request_handler(uint8_t request, uint16_t* request_params, uin
|
||||
return rfcat_subcommand(request_params[0], data, *data_len);
|
||||
break;
|
||||
|
||||
case UBERTOOTH_XMAS:
|
||||
requested_mode = MODE_XMAS;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1072,6 +1072,23 @@ int cmd_rfcat_subcmd(struct libusb_device_handle* devh, int cmd, uint8_t *body,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cmd_xmas(struct libusb_device_handle* devh) {
|
||||
int r;
|
||||
|
||||
r = libusb_control_transfer(devh, CTRL_OUT, UBERTOOTH_XMAS, 0, 0,
|
||||
NULL, 0, 1000);
|
||||
if (r < 0) {
|
||||
if (r == LIBUSB_ERROR_PIPE) {
|
||||
fprintf(stderr, "control message unsupported\n");
|
||||
} else {
|
||||
show_libusb_error(r);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ubertooth_cmd_sync(struct libusb_device_handle* devh,
|
||||
uint8_t type,
|
||||
uint8_t command,
|
||||
|
||||
@@ -143,5 +143,6 @@ int cmd_afh(struct libusb_device_handle* devh);
|
||||
int cmd_hop(struct libusb_device_handle* devh);
|
||||
int cmd_cancel_follow(struct libusb_device_handle* devh);
|
||||
int cmd_rfcat_subcmd(struct libusb_device_handle* devh, int cmd, uint8_t *body, size_t body_len);
|
||||
int cmd_xmas(struct libusb_device_handle* devh);
|
||||
|
||||
#endif /* __UBERTOOTH_CONTROL_H__ */
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
// increment on every API change
|
||||
#define UBERTOOTH_API_VERSION 0x0106
|
||||
#define UBERTOOTH_API_VERSION 0x0107
|
||||
|
||||
#define DMA_SIZE 50
|
||||
|
||||
@@ -113,6 +113,7 @@ enum ubertooth_usb_commands {
|
||||
UBERTOOTH_CANCEL_FOLLOW = 70,
|
||||
UBERTOOTH_LE_SET_ADV_DATA = 71,
|
||||
UBERTOOTH_RFCAT_SUBCMD = 72,
|
||||
UBERTOOTH_XMAS = 73,
|
||||
};
|
||||
|
||||
enum rfcat24_subcommands {
|
||||
|
||||
@@ -65,6 +65,7 @@ static void usage(FILE *output)
|
||||
fprintf(output, "\t-b get hardware board id number\n");
|
||||
fprintf(output, "\t-p get microcontroller Part ID\n");
|
||||
fprintf(output, "\t-s get microcontroller serial number\n");
|
||||
fprintf(output, "\t-x xmas lights\n");
|
||||
}
|
||||
|
||||
#define MAX_VERSION_STRING_LEN 255
|
||||
@@ -81,7 +82,7 @@ int main(int argc, char *argv[])
|
||||
int do_range_result, do_all_leds, do_identify;
|
||||
int do_set_squelch, do_get_squelch, squelch_level;
|
||||
int do_something, do_compile_info;
|
||||
int do_number;
|
||||
int do_number, do_xmas;
|
||||
int ubertooth_device = -1;
|
||||
char version_string[MAX_VERSION_STRING_LEN];
|
||||
|
||||
@@ -94,9 +95,9 @@ int main(int argc, char *argv[])
|
||||
do_range_result= do_all_leds= do_identify= -1;
|
||||
do_set_squelch= -1, do_get_squelch= -1; squelch_level= 0;
|
||||
do_something= 0; do_compile_info= -1;
|
||||
do_number= 0;
|
||||
do_number= 0; do_xmas= 0;
|
||||
|
||||
while ((opt=getopt(argc,argv,"U:hnmefiIprsStvbl::a::C::c::d::q::z::9VN")) != EOF) {
|
||||
while ((opt=getopt(argc,argv,"U:hnmefiIprsStvbl::a::C::c::d::q::z::9VNx")) != EOF) {
|
||||
switch(opt) {
|
||||
case 'U':
|
||||
ubertooth_device = atoi(optarg);
|
||||
@@ -195,6 +196,9 @@ int main(int argc, char *argv[])
|
||||
case 'N':
|
||||
do_number = 1;
|
||||
break;
|
||||
case 'x':
|
||||
do_xmas = 1;
|
||||
break;
|
||||
case 'h':
|
||||
usage(stdout);
|
||||
return 0;
|
||||
@@ -348,6 +352,9 @@ int main(int argc, char *argv[])
|
||||
r = cmd_get_squelch(ut->devh);
|
||||
fprintf(stdout, "Squelch set to %d\n", (int8_t)r);
|
||||
}
|
||||
if(do_xmas) {
|
||||
return cmd_xmas(ut->devh);
|
||||
}
|
||||
if(do_something) {
|
||||
unsigned char buf[4] = { 0x55, 0x55, 0x55, 0x55 };
|
||||
cmd_do_something(ut->devh, NULL, 0);
|
||||
|
||||
Reference in New Issue
Block a user