diff --git a/tools/bluemoon.c b/tools/bluemoon.c
index 663d1f9..b7c5197 100644
--- a/tools/bluemoon.c
+++ b/tools/bluemoon.c
{ "reset", no_argument, NULL, 'R' },
{ "coldboot", no_argument, NULL, 'B' },
{ "index", required_argument, NULL, 'i' },
+ { "raw", no_argument, NULL, 'r' },
{ "version", no_argument, NULL, 'v' },
{ "help", no_argument, NULL, 'h' },
{ }
int main(int argc, char *argv[])
{
const char *str;
+ bool use_raw = false;
sigset_t mask;
int exit_status;
for (;;) {
int opt;
- opt = getopt_long(argc, argv, "A::DF::C:TRBi:vh",
+ opt = getopt_long(argc, argv, "A::DF::C:TREi:rvh",
main_options, NULL);
if (opt < 0)
break;
}
hci_index = atoi(str);
break;
+ case 'r':
+ use_raw = true;
+ break;
case 'v':
printf("%s\n", VERSION);
return EXIT_SUCCESS;
return EXIT_SUCCESS;
}
- hci_dev = bt_hci_new_user_channel(hci_index);
- if (!hci_dev) {
- fprintf(stderr, "Failed to open HCI user channel\n");
- return EXIT_FAILURE;
+ if (use_raw) {
+ hci_dev = bt_hci_new_raw_device(hci_index);
+ if (!hci_dev) {
+ fprintf(stderr, "Failed to open HCI raw device\n");
+ return EXIT_FAILURE;
+ }
+ } else {
+ hci_dev = bt_hci_new_user_channel(hci_index);
+ if (!hci_dev) {
+ fprintf(stderr, "Failed to open HCI user channel\n");
+ return EXIT_FAILURE;
+ }
}
bt_hci_send(hci_dev, CMD_READ_VERSION, NULL, 0,