Blame tools/hwdb.c

Packit 34410b
/*
Packit 34410b
 *
Packit 34410b
 *  BlueZ - Bluetooth protocol stack for Linux
Packit 34410b
 *
Packit 34410b
 *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
Packit 34410b
 *
Packit 34410b
 *
Packit 34410b
 *  This program is free software; you can redistribute it and/or modify
Packit 34410b
 *  it under the terms of the GNU General Public License as published by
Packit 34410b
 *  the Free Software Foundation; either version 2 of the License, or
Packit 34410b
 *  (at your option) any later version.
Packit 34410b
 *
Packit 34410b
 *  This program is distributed in the hope that it will be useful,
Packit 34410b
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 34410b
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 34410b
 *  GNU General Public License for more details.
Packit 34410b
 *
Packit 34410b
 *  You should have received a copy of the GNU General Public License
Packit 34410b
 *  along with this program; if not, write to the Free Software
Packit 34410b
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
Packit 34410b
 *
Packit 34410b
 */
Packit 34410b
Packit 34410b
#ifdef HAVE_CONFIG_H
Packit 34410b
#include <config.h>
Packit 34410b
#endif
Packit 34410b
Packit 34410b
#include <stdio.h>
Packit 34410b
Packit 34410b
#include "lib/bluetooth.h"
Packit 34410b
Packit 34410b
static const struct {
Packit 34410b
	uint16_t vendor;
Packit 34410b
	uint16_t product;
Packit 34410b
	const char *str;
Packit 34410b
} product_table[] = {
Packit 34410b
	{ 0x0078, 0x0001, "Nike+ FuelBand"	},
Packit 34410b
	{ 0x0097, 0x0002, "COOKOO watch"	},
Packit 34410b
	{ }
Packit 34410b
};
Packit 34410b
Packit 34410b
int main(int argc, char *argv[])
Packit 34410b
{
Packit 34410b
	uint16_t id;
Packit 34410b
Packit 34410b
	printf("# This file is part of systemd.\n");
Packit 34410b
	printf("#\n");
Packit 34410b
	printf("# Data imported from:\n");
Packit 34410b
	printf("#  http://www.bluetooth.org/Technical/AssignedNumbers/identifiers.htm\n");
Packit 34410b
Packit 34410b
	for (id = 0;; id++) {
Packit 34410b
		const char *str;
Packit 34410b
		int i;
Packit 34410b
Packit 34410b
		str = bt_compidtostr(id);
Packit 34410b
		if (!str)
Packit 34410b
			break;
Packit 34410b
Packit 34410b
		if (!strcmp(str, "internal use"))
Packit 34410b
			break;
Packit 34410b
Packit 34410b
		if (!strcmp(str, "not assigned"))
Packit 34410b
			continue;
Packit 34410b
Packit 34410b
		printf("\n");
Packit 34410b
		printf("bluetooth:v%04X*\n", id);
Packit 34410b
		printf(" ID_VENDOR_FROM_DATABASE=%s\n", str);
Packit 34410b
Packit 34410b
		for (i = 0; product_table[i].str; i++) {
Packit 34410b
			if (product_table[i].vendor != id)
Packit 34410b
				continue;
Packit 34410b
Packit 34410b
			printf("\n");
Packit 34410b
			printf("bluetooth:v%04Xp%04X*\n",
Packit 34410b
						id, product_table[i].product);
Packit 34410b
			printf(" ID_PRODUCT_FROM_DATABASE=%s\n",
Packit 34410b
							product_table[i].str);
Packit 34410b
		}
Packit 34410b
	}
Packit 34410b
Packit 34410b
	return 0;
Packit 34410b
}