From 54fa756e52fc2140b804b1a347ccacddc01e2d71 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 27 Dec 2012 23:42:42 -0800 Subject: [PATCH] tools: Add utility for creating hwdb from company identifiers --- .gitignore | 1 + Makefile.tools | 4 +++- tools/hwdb.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 tools/hwdb.c diff --git a/.gitignore b/.gitignore index dd71f953c..7fb8a540a 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,7 @@ profiles/cups/bluetooth attrib/gatttool tools/avinfo tools/bccmd +tools/hwdb tools/ciptool tools/hciattach tools/hciconfig diff --git a/Makefile.tools b/Makefile.tools index f53760d26..333c16e17 100644 --- a/Makefile.tools +++ b/Makefile.tools @@ -133,7 +133,7 @@ endif if EXPERIMENTAL noinst_PROGRAMS += tools/bdaddr tools/avinfo tools/avtest tools/scotest \ - tools/hcieventmask tools/hcisecfilter \ + tools/hcieventmask tools/hcisecfilter tools/hwdb \ tools/btmgmt tools/btattach tools/btsnoop \ tools/btiotest tools/mpris-player @@ -148,6 +148,8 @@ tools_scotest_LDADD = lib/libbluetooth-private.la tools_hcieventmask_LDADD = lib/libbluetooth-private.la +tools_hwdb_LDADD = lib/libbluetooth-private.la + tools_btmgmt_SOURCES = tools/btmgmt.c src/glib-helper.c src/eir.c tools_btmgmt_LDADD = lib/libbluetooth-private.la @GLIB_LIBS@ diff --git a/tools/hwdb.c b/tools/hwdb.c new file mode 100644 index 000000000..3e591f78f --- /dev/null +++ b/tools/hwdb.c @@ -0,0 +1,61 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2002-2010 Marcel Holtmann + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#include + +int main(int argc, char *argv[]) +{ + uint16_t id; + + printf("# This file is part of systemd.\n"); + printf("#\n"); + printf("# Data imported from:\n"); + printf("# http://www.bluetooth.org/Technical/AssignedNumbers/identifiers.htm\n"); + printf("\n"); + + for (id = 0;; id++) { + char *str; + + str = bt_compidtostr(id); + if (!str) + break; + + if (!strcmp(str, "internal use")) + break; + + if (!strcmp(str, "not assigned")) + continue; + + printf("bluetooth:v%04X*\n", id); + printf(" ID_VENDOR_FROM_DATABASE=%s\n", str); + printf("\n"); + } + + return 0; +} -- 2.47.3