diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/ciptool.c | 29 | ||||
-rw-r--r-- | tools/csr.c | 34 | ||||
-rw-r--r-- | tools/csr.h | 29 | ||||
-rw-r--r-- | tools/hciattach.c | 52 | ||||
-rw-r--r-- | tools/hciconfig.c | 51 | ||||
-rw-r--r-- | tools/hcisecfilter.c | 63 | ||||
-rw-r--r-- | tools/hcitool.c | 51 | ||||
-rw-r--r-- | tools/hid2hci.c | 30 | ||||
-rw-r--r-- | tools/l2ping.c | 87 | ||||
-rw-r--r-- | tools/ppporc.c | 50 | ||||
-rw-r--r-- | tools/sdptool.c | 55 |
11 files changed, 295 insertions, 236 deletions
diff --git a/tools/ciptool.c b/tools/ciptool.c index fc23bf2e..d0b6625d 100644 --- a/tools/ciptool.c +++ b/tools/ciptool.c @@ -1,23 +1,26 @@ /* * - * Bluetooth Common ISDN Access Profile (CIP) + * BlueZ - Bluetooth protocol stack for Linux * - * Copyright (C) 2002-2003 Marcel Holtmann <marcel@holtmann.org> + * Copyright (C) 2002-2004 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 as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; * - * 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. + * 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. * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + * SOFTWARE IS DISCLAIMED. * * * $Id$ @@ -46,7 +49,6 @@ #include <bluetooth/sdp_lib.h> #include <bluetooth/cmtp.h> - static volatile sig_atomic_t __io_canceled = 0; static void sig_hup(int sig) @@ -387,7 +389,6 @@ static void cmd_loopback(int ctl, bdaddr_t *bdaddr, int argc, char **argv) ioctl(ctl, CMTPCONNDEL, &req); } - static struct { char *cmd; char *alt; diff --git a/tools/csr.c b/tools/csr.c index e2069cd7..60cba66b 100644 --- a/tools/csr.c +++ b/tools/csr.c @@ -1,26 +1,35 @@ /* * - * CSR BlueCore specific functions + * BlueZ - Bluetooth protocol stack for Linux * - * Copyright (C) 2003 Marcel Holtmann <marcel@holtmann.org> + * Copyright (C) 2003-2004 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 as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; * - * 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. + * 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. * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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 <string.h> @@ -32,7 +41,6 @@ #include "csr.h" - static struct { uint16_t id; char *str; diff --git a/tools/csr.h b/tools/csr.h index 254f108e..b96dd0f7 100644 --- a/tools/csr.h +++ b/tools/csr.h @@ -1,24 +1,29 @@ /* * - * CSR BlueCore specific functions + * BlueZ - Bluetooth protocol stack for Linux * - * Copyright (C) 2003 Marcel Holtmann <marcel@holtmann.org> + * Copyright (C) 2003-2004 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 as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; * - * 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. + * 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. * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + * SOFTWARE IS DISCLAIMED. * + * + * $Id$ */ #define CSR_VARID_BUILDID 0x2819 diff --git a/tools/hciattach.c b/tools/hciattach.c index 926e3fab..7194ad6a 100644 --- a/tools/hciattach.c +++ b/tools/hciattach.c @@ -1,27 +1,31 @@ -/* - BlueZ - Bluetooth protocol stack for Linux - Copyright (C) 2000-2001 Qualcomm Incorporated - - Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> - - 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$ + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2000-2001 Qualcomm Incorporated + * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com> + * Copyright (C) 2002-2004 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 @@ -47,8 +51,8 @@ #include <bluetooth/bluetooth.h> #include <bluetooth/hci.h> -#include <bluetooth/hci_uart.h> #include <bluetooth/hci_lib.h> +#include <bluetooth/hci_uart.h> struct uart_t { char *type; diff --git a/tools/hciconfig.c b/tools/hciconfig.c index 6393764b..d7b7513a 100644 --- a/tools/hciconfig.c +++ b/tools/hciconfig.c @@ -1,28 +1,31 @@ -/* - BlueZ - Bluetooth protocol stack for Linux - Copyright (C) 2000-2001 Qualcomm Incorporated - - Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> - - 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$ + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2000-2001 Qualcomm Incorporated + * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com> + * Copyright (C) 2002-2004 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 diff --git a/tools/hcisecfilter.c b/tools/hcisecfilter.c index 9aaead0f..fd296afd 100644 --- a/tools/hcisecfilter.c +++ b/tools/hcisecfilter.c @@ -1,3 +1,36 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com> + * Copyright (C) 2002-2004 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 <sys/socket.h> @@ -11,23 +44,23 @@ int main(void) uint32_t event_mask[2]; uint32_t ocf_mask[4]; - // Packet types + /* Packet types */ memset((void *)&type_mask, 0, sizeof(type_mask)); hci_set_bit(HCI_EVENT_PKT, &type_mask); - + printf("Type mask: { 0x%x }\n", type_mask); - // Events + /* Events */ memset((void *)event_mask, 0, sizeof(event_mask)); - hci_set_bit(EVT_INQUIRY_COMPLETE, event_mask); - hci_set_bit(EVT_INQUIRY_RESULT, event_mask); + hci_set_bit(EVT_INQUIRY_COMPLETE, event_mask); + hci_set_bit(EVT_INQUIRY_RESULT, event_mask); - hci_set_bit(EVT_CONN_COMPLETE, event_mask); - hci_set_bit(EVT_CONN_REQUEST, event_mask); - hci_set_bit(EVT_DISCONN_COMPLETE, event_mask); + hci_set_bit(EVT_CONN_COMPLETE, event_mask); + hci_set_bit(EVT_CONN_REQUEST, event_mask); + hci_set_bit(EVT_DISCONN_COMPLETE, event_mask); - hci_set_bit(EVT_AUTH_COMPLETE, event_mask); - hci_set_bit(EVT_ENCRYPT_CHANGE, event_mask); + hci_set_bit(EVT_AUTH_COMPLETE, event_mask); + hci_set_bit(EVT_ENCRYPT_CHANGE, event_mask); hci_set_bit(EVT_CMD_COMPLETE, event_mask); hci_set_bit(EVT_CMD_STATUS, event_mask); @@ -38,7 +71,7 @@ int main(void) printf("Event mask: { 0x%x, 0x%x }\n", event_mask[0], event_mask[1]); - // OGF_LINK_CTL + /* OGF_LINK_CTL */ memset((void *) ocf_mask, 0, sizeof(ocf_mask)); hci_set_bit(OCF_INQUIRY, ocf_mask); hci_set_bit(OCF_REMOTE_NAME_REQ, ocf_mask); @@ -48,7 +81,7 @@ int main(void) printf("OGF_LINK_CTL: { 0x%x, 0x%x, 0x%x, 0x%x }\n", ocf_mask[0], ocf_mask[1], ocf_mask[2], ocf_mask[3]); - // OGF_LINK_POLICY + /* OGF_LINK_POLICY */ memset((void *) ocf_mask, 0, sizeof(ocf_mask)); hci_set_bit(OCF_ROLE_DISCOVERY, ocf_mask); hci_set_bit(OCF_READ_LINK_POLICY, ocf_mask); @@ -56,7 +89,7 @@ int main(void) printf("OGF_LINK_POLICY: { 0x%x, 0x%x, 0x%x, 0x%x }\n", ocf_mask[0], ocf_mask[1], ocf_mask[2], ocf_mask[3]); - // OGF_HOST_CTL + /* OGF_HOST_CTL */ memset((void *) ocf_mask, 0, sizeof(ocf_mask)); hci_set_bit(OCF_READ_AUTH_ENABLE, ocf_mask); hci_set_bit(OCF_READ_ENCRYPT_MODE, ocf_mask); @@ -68,7 +101,7 @@ int main(void) printf("OGF_HOST_CTL: { 0x%x, 0x%x, 0x%x, 0x%x }\n", ocf_mask[0], ocf_mask[1], ocf_mask[2], ocf_mask[3]); - // OGF_INFO_PARAM + /* OGF_INFO_PARAM */ memset((void *) ocf_mask, 0, sizeof(ocf_mask)); hci_set_bit(OCF_READ_LOCAL_VERSION, ocf_mask); hci_set_bit(OCF_READ_LOCAL_FEATURES, ocf_mask); @@ -79,7 +112,7 @@ int main(void) printf("OGF_INFO_PARAM: { 0x%x, 0x%x, 0x%x, 0x%x}\n", ocf_mask[0], ocf_mask[1], ocf_mask[2], ocf_mask[3]); - // OGF_INFO_PARAM + /* OGF_INFO_PARAM */ memset((void *) ocf_mask, 0, sizeof(ocf_mask)); hci_set_bit(OCF_READ_FAILED_CONTACT_COUNTER, ocf_mask); hci_set_bit(OCF_RESET_FAILED_CONTACT_COUNTER, ocf_mask); diff --git a/tools/hcitool.c b/tools/hcitool.c index 99355861..5cecdf7e 100644 --- a/tools/hcitool.c +++ b/tools/hcitool.c @@ -1,28 +1,31 @@ -/* - BlueZ - Bluetooth protocol stack for Linux - Copyright (C) 2000-2001 Qualcomm Incorporated - - Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> - - 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$ + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2000-2001 Qualcomm Incorporated + * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com> + * Copyright (C) 2002-2004 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 diff --git a/tools/hid2hci.c b/tools/hid2hci.c index 95a7c7d6..73b7e12c 100644 --- a/tools/hid2hci.c +++ b/tools/hid2hci.c @@ -1,23 +1,26 @@ /* * - * Bluetooth HID to HCI mode switching utility + * BlueZ - Bluetooth protocol stack for Linux * * Copyright (C) 2003-2004 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 as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; * - * 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. + * 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. * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + * SOFTWARE IS DISCLAIMED. * * * $Id$ @@ -38,7 +41,6 @@ #include <getopt.h> #include <sys/ioctl.h> - static char usbpath[PATH_MAX + 1] = "/proc/bus/usb"; struct usb_device_descriptor { @@ -75,7 +77,6 @@ struct usb_ctrltransfer { #define USB_TYPE_VENDOR 0x40 #define USB_DIR_OUT 0x00 - static char devpath[PATH_MAX + 1] = "/dev"; struct hiddev_devinfo { @@ -113,7 +114,6 @@ struct hiddev_usage_ref { #define HID_REPORT_TYPE_OUTPUT 2 - #define HCI 0 #define HID 1 @@ -132,7 +132,6 @@ struct device_info { struct device_id *id; }; - static int switch_hidproxy(struct device_info *dev) { struct usb_ctrltransfer ctrl; @@ -347,7 +346,6 @@ static int find_devices(int mode, struct device_info *dev, size_t size) return count; } - static void usage(void) { printf("hid2hci - Bluetooth HID to HCI mode switching utility\n\n"); diff --git a/tools/l2ping.c b/tools/l2ping.c index d5d7748b..85d12eee 100644 --- a/tools/l2ping.c +++ b/tools/l2ping.c @@ -1,30 +1,37 @@ -/* - BlueZ - Bluetooth protocol stack for Linux - Copyright (C) 2000-2001 Qualcomm Incorporated - - Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> - - 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$ + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2000-2001 Qualcomm Incorporated + * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com> + * Copyright (C) 2002-2004 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 <stdlib.h> #include <unistd.h> @@ -93,20 +100,20 @@ static void ping(char *svr) memset(&addr, 0, sizeof(addr)); addr.l2_family = AF_BLUETOOTH; addr.l2_bdaddr = bdaddr; - if (bind(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { + if (bind(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { perror("Can't bind socket."); exit(1); - } + } str2ba(svr, &addr.l2_bdaddr); - if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) { + if (connect(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { perror("Can't connect."); exit(1); } /* Get local address */ opt = sizeof(addr); - if( getsockname(s, (struct sockaddr *)&addr, &opt) < 0 ) { + if (getsockname(s, (struct sockaddr *)&addr, &opt) < 0) { perror("Can't get local address."); exit(1); } @@ -115,7 +122,7 @@ static void ping(char *svr) printf("Ping: %s from %s (data size %d) ...\n", svr, str, size); /* Initialize buffer */ - for(i = L2CAP_CMD_HDR_SIZE; i < sizeof(buf); i++) + for (i = L2CAP_CMD_HDR_SIZE; i < sizeof(buf); i++) buf[i]=(i%40)+'A'; id = ident; @@ -132,34 +139,34 @@ static void ping(char *svr) gettimeofday(&tv_send, NULL); /* Send Echo Request */ - if( send(s, buf, size + L2CAP_CMD_HDR_SIZE, 0) <= 0 ){ + if (send(s, buf, size + L2CAP_CMD_HDR_SIZE, 0) <= 0) { perror("Send failed"); exit(1); } /* Wait for Echo Response */ lost = 0; - while( 1 ) { + while (1) { struct pollfd pf[1]; register int err; pf[0].fd = s; pf[0].events = POLLIN; - if( (err = poll(pf, 1, 10*1000)) < 0 ) { + if ((err = poll(pf, 1, 10*1000)) < 0) { perror("Poll failed"); exit(1); } - if( !err ){ + if (!err) { lost = 1; break; } - if( (err = recv(s, buf, sizeof(buf), 0)) < 0 ) { + if ((err = recv(s, buf, sizeof(buf), 0)) < 0) { perror("Recv failed"); exit(1); } - if( !err ){ + if (!err){ printf("Disconnected\n"); exit(1); } @@ -171,9 +178,9 @@ static void ping(char *svr) continue; /* Check type */ - if( cmd->code == L2CAP_ECHO_RSP ) + if (cmd->code == L2CAP_ECHO_RSP) break; - if( cmd->code == L2CAP_COMMAND_REJ ){ + if (cmd->code == L2CAP_COMMAND_REJ) { printf("Peer doesn't support Echo packets\n"); exit(1); } @@ -181,7 +188,7 @@ static void ping(char *svr) } sent_pkt++; - if( !lost ){ + if (!lost) { recv_pkt++; gettimeofday(&tv_recv, NULL); @@ -189,12 +196,12 @@ static void ping(char *svr) printf("%d bytes from %s id %d time %.2fms\n", cmd->len, svr, id, tv2fl(tv_diff)); - if( delay ) sleep(delay); + if (delay) sleep(delay); } else { printf("no response from %s: id %d\n", svr, id); } - if( ++id > 254 ) id = ident; + if (++id > 254) id = ident; } stat(0); } diff --git a/tools/ppporc.c b/tools/ppporc.c index 514ceb65..60aefd39 100644 --- a/tools/ppporc.c +++ b/tools/ppporc.c @@ -1,26 +1,35 @@ /* * - * PPP over Bluetooth RFCOMM + * BlueZ - Bluetooth protocol stack for Linux * - * Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> + * Copyright (C) 2002-2004 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 as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; * - * 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. + * 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. * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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 <fcntl.h> @@ -35,11 +44,9 @@ #include <bluetooth/bluetooth.h> #include <bluetooth/rfcomm.h> - extern int optind, opterr, optopt; extern char *optarg; - /* IO cancelation */ static volatile sig_atomic_t __io_canceled; @@ -53,7 +60,6 @@ static inline void io_cancel(void) __io_canceled = 1; } - /* Signal functions */ static void sig_hup(int sig) { @@ -66,7 +72,6 @@ static void sig_term(int sig) io_cancel(); } - /* Read exactly len bytes (Signal safe)*/ static inline int read_n(int fd, char *buf, int len) { @@ -88,7 +93,6 @@ static inline int read_n(int fd, char *buf, int len) return t; } - /* Write exactly len bytes (Signal safe)*/ static inline int write_n(int fd, char *buf, int len) { @@ -110,7 +114,6 @@ static inline int write_n(int fd, char *buf, int len) return t; } - /* Create the RFCOMM connection */ static int create_connection(bdaddr_t *bdaddr, uint8_t channel) { @@ -142,7 +145,6 @@ static int create_connection(bdaddr_t *bdaddr, uint8_t channel) return fd; } - /* Process the data from socket and pseudo tty */ static int process_data(int fd) { @@ -157,7 +159,7 @@ static int process_data(int fd) p[1].events = POLLIN | POLLERR | POLLHUP | POLLNVAL; err = 0; - + while (!__io_canceled) { p[0].revents = 0; p[1].revents = 0; @@ -186,7 +188,7 @@ static int process_data(int fd) if (p[1].revents) { if (p[1].revents & (POLLERR | POLLHUP | POLLNVAL)) - break; + break; r = read(fd, buf, sizeof(buf)); if (r < 0) { if (errno != EINTR && errno != EAGAIN) { @@ -204,13 +206,11 @@ static int process_data(int fd) return err; } - static void usage(void) { printf("Usage:\tppporc <bdaddr> [channel]\n"); } - int main(int argc, char** argv) { struct sigaction sa; @@ -219,7 +219,6 @@ int main(int argc, char** argv) bdaddr_t bdaddr; uint8_t channel; - /* Parse command line options */ while ((opt = getopt(argc, argv, "h")) != EOF) { switch(opt) { @@ -246,12 +245,10 @@ int main(int argc, char** argv) exit(0); } - /* Initialize syslog */ openlog("ppporc", LOG_PID | LOG_NDELAY | LOG_PERROR, LOG_DAEMON); syslog(LOG_INFO, "PPP over RFCOMM"); - /* Initialize signals */ memset(&sa, 0, sizeof(sa)); sa.sa_flags = SA_NOCLDSTOP; @@ -266,7 +263,6 @@ int main(int argc, char** argv) sa.sa_handler = sig_hup; sigaction(SIGHUP, &sa, NULL); - syslog(LOG_INFO, "Connecting to %s", argv[0]); if ((fd = create_connection(&bdaddr, channel)) < 0) { diff --git a/tools/sdptool.c b/tools/sdptool.c index 87646cab..1dcdf8e4 100644 --- a/tools/sdptool.c +++ b/tools/sdptool.c @@ -1,31 +1,32 @@ /* - Service Discovery Protocol (SDP) - Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> - Copyright (C) 2002 Stephen Crane <steve.crane@rococosoft.com> - - Based on original SDP implementation by Nokia Corporation. - Copyright (C) 2001,2002 Nokia Corporation. - Original author Guruprasad Krishnamurthy <guruprasad.krishnamurthy@nokia.com> - - 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$ + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2001-2002 Nokia Corporation + * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com> + * Copyright (C) 2002-2004 Marcel Holtmann <marcel@holtmann.org> + * Copyright (C) 2002-2003 Stephen Crane <steve.crane@rococosoft.com> + * + * + * 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 |