diff options
| author | Marcel Holtmann <marcel@holtmann.org> | 2005-09-08 10:54:30 +0000 | 
|---|---|---|
| committer | Marcel Holtmann <marcel@holtmann.org> | 2005-09-08 10:54:30 +0000 | 
| commit | 36e1d1d1f94e5cf10e9d5cf7de1d2878b3d33ed8 (patch) | |
| tree | 6815b0665e244aa5af8d2a4749e25b41ac7d86b3 /tools | |
| parent | 0738cf5e684464d157816be73c0b19efb7dd4fc7 (diff) | |
Add skeleton for the csrinit utility
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/Makefile.am | 19 | ||||
| -rw-r--r-- | tools/csrinit.8 | 35 | ||||
| -rw-r--r-- | tools/csrinit.c | 101 | 
3 files changed, 152 insertions, 3 deletions
| diff --git a/tools/Makefile.am b/tools/Makefile.am index e3983a17..3a018bb7 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -18,6 +18,14 @@ hid2hci_programs =  hid2hci_manfiles =  endif +if CSRINIT +csrinit_programs = csrinit +csrinit_manfiles = csrinit.8 +else +csrinit_programs = +csrinit_manfiles = +endif +  if DFUTOOL  dfutool_programs = dfutool  dfutool_manfiles = dfutool.1 @@ -26,7 +34,7 @@ dfutool_programs =  dfutool_manfiles =  endif -sbin_PROGRAMS = hciattach hciconfig $(avctrl_programs) $(hid2hci_programs) +sbin_PROGRAMS = hciattach hciconfig $(avctrl_programs) $(hid2hci_programs) $(csrinit_programs)  bin_PROGRAMS = hcitool l2ping sdptool ciptool $(dfutool_programs) @@ -60,6 +68,11 @@ if HID2HCI  hid2hci_LDADD = @USB_LIBS@  endif +if CSRINIT +csrinit_SOURCES = csrinit.c csr.h +csrinit_LDADD = @USB_LIBS@ +endif +  if DFUTOOL  dfutool_SOURCES = dfutool.c dfu.h dfu.c  dfutool_LDADD = @USB_LIBS@ @@ -70,8 +83,8 @@ AM_CFLAGS = @BLUEZ_CFLAGS@ @USB_CFLAGS@  INCLUDES = -I$(top_srcdir)/common  man_MANS = hciattach.8 hciconfig.8 hcitool.1 l2ping.1 sdptool.1 ciptool.1 \ -		$(avctrl_manfiles) $(hid2hci_manfiles) $(dfutool_manfiles) +		$(avctrl_manfiles) $(hid2hci_manfiles) $(csrinit_manfiles) $(dfutool_manfiles) -EXTRA_DIST = $(man_MANS) avctrl.8 hid2hci.8 dfutool.1 example.psr +EXTRA_DIST = $(man_MANS) avctrl.8 hid2hci.8 csrinit.8 dfutool.1 example.psr  MAINTAINERCLEANFILES = Makefile.in diff --git a/tools/csrinit.8 b/tools/csrinit.8 new file mode 100644 index 00000000..35a033d9 --- /dev/null +++ b/tools/csrinit.8 @@ -0,0 +1,35 @@ +.\" +.\"	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., 675 Mass Ave, Cambridge, MA 02139, USA. +.\" +.\" +.TH CSRINIT 8 "SEPTEMBER 8, 2005" "" "" + +.SH NAME +csrinit \- Utility for the setting up CSR ROM chips +.SH SYNOPSIS +.BR "csrinit +[ +.I options +] +.SH DESCRIPTION +.B csrinit +is used to setup the ROM chips from CSR. +.SH OPTIONS +.TP +.BI -h +Gives a list of possible options. +.SH AUTHOR +Written by Marcel Holtmann <marcel@holtmann.org>. +.br diff --git a/tools/csrinit.c b/tools/csrinit.c new file mode 100644 index 00000000..07310175 --- /dev/null +++ b/tools/csrinit.c @@ -0,0 +1,101 @@ +/* + * + *  BlueZ - Bluetooth protocol stack for Linux + * + *  Copyright (C) 2004-2005  Marcel Holtmann <marcel@holtmann.org> + * + * + *  This program is free software; you can redistribute it and/or modify + *  it under the terms of the GNU General Public License version 2 as + *  published by the Free Software Foundation; + * + *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + *  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY + *  CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES  + *  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN  + *  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF  + *  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + *  ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,  + *  COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS  + *  SOFTWARE IS DISCLAIMED. + * + * + *  $Id$ + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <errno.h> +#include <getopt.h> + +#include <usb.h> + +#include "csr.h" + +#ifdef NEED_USB_GET_BUSSES +static inline struct usb_bus *usb_get_busses(void) +{ +	return usb_busses; +} +#endif + +#ifndef USB_DIR_OUT +#define USB_DIR_OUT	0x00 +#endif + +#ifndef USB_DIR_IN +#define USB_DIR_IN	0x80 +#endif + +static void usage(void) +{ +	printf("csrinit - Utility for the setting up CSR ROM chips\n\n"); + +	printf("Usage:\n" +		"\tcsrinit [options]\n" +		"\n"); + +	printf("Options:\n" +		"\t-h, --help           Display help\n" +		"\n"); +} + +static struct option main_options[] = { +	{ "help",	0, 0, 'h' }, +	{ 0, 0, 0, 0 } +}; + +int main(int argc, char *argv[]) +{ +	int opt; + +	while ((opt = getopt_long(argc, argv, "+h", main_options, NULL)) != -1) { +		switch (opt) { +		case 'h': +			usage(); +			exit(0); + +		default: +			exit(0); +		} +	} + +	argc -= optind; +	argv += optind; +	optind = 0; + +	if (argc < 1) { +		usage(); +		exit(1); +	} + +	usb_init(); + +	return 0; +} | 
