Exemplo n.º 1
0
int main(int argc, char *argv[])
{
	int opt;
	int bitstream = 0;
	int modulation = MOD_BT_BASIC_RATE;
	char ubertooth_device = -1;

	ubertooth_t* ut = NULL;
	int r;

	while ((opt=getopt(argc,argv,"bhclU:d:")) != EOF) {
		switch(opt) {
		case 'b':
			bitstream = 1;
			break;
		case 'c':
			modulation = MOD_BT_BASIC_RATE;
			break;
		case 'l':
			modulation = MOD_BT_LOW_ENERGY;
			break;
		case 'U':
			ubertooth_device = atoi(optarg);
			break;
		case 'd':
			dumpfile = fopen(optarg, "w");
			if (dumpfile == NULL) {
				perror(optarg);
				return 1;
			}
			break;
		case 'h':
		default:
			usage();
			return 1;
		}
	}

	ut = ubertooth_start(ubertooth_device);

	if (ut == NULL) {
		usage();
		return 1;
	}

	r = ubertooth_check_api(ut);
	if (r < 0)
		return 1;

	/* Clean up on exit. */
	register_cleanup_handler(ut, 1);

	cmd_set_modulation(ut->devh, modulation);
	rx_dump(ut, bitstream);

	ubertooth_stop(ut);
	return 0;
}
Exemplo n.º 2
0
int main(int argc, char *argv[])
{
	int opt;
	int bitstream = 0;
	int modulation = MOD_BT_BASIC_RATE;
	char ubertooth_device = -1;
	struct libusb_device_handle *devh = NULL;

	while ((opt=getopt(argc,argv,"bhclU:d:")) != EOF) {
		switch(opt) {
		case 'b':
			bitstream = 1;
			break;
		case 'c':
			modulation = MOD_BT_BASIC_RATE;
			break;
		case 'l':
			modulation = MOD_BT_LOW_ENERGY;
			break;
		case 'U':
			ubertooth_device = atoi(optarg);
			break;
		case 'd':
			dumpfile = fopen(optarg, "w");
			if (dumpfile == NULL) {
				perror(optarg);
				return 1;
			}
			break;
		case 'h':
		default:
			usage();
			return 1;
		}
	}

	devh = ubertooth_start(ubertooth_device);

	if (devh == NULL) {
		usage();
		return 1;
	}

	cmd_set_modulation(devh, modulation);
	rx_dump(devh, bitstream);

	ubertooth_stop(devh);
	return 0;
}