Commit Graph

185 Commits

Author SHA1 Message Date
Brad Davis
00d5b07760 Fix the install location of hcsecd.conf
Submitted by:	vangyzen
Approved by:	re (marius)
2018-08-26 02:09:20 +00:00
Brad Davis
c8e7055577 Move all bluetooth related config files out of etc
This helps with pkgbase by switching to CONFS so they are properly tagged as
config files.

Approved by:	will (mentor)
Differential Revision:	https://reviews.freebsd.org/D16833
2018-08-21 19:28:53 +00:00
Vladimir Kondratyev
44af5666d9 bthidd(8): Add evdev protocol support for bluetooth keyboards and mouses
User-visible changes:

"-u" is added to to list of command line options supported by bthidd.
Use it to enable evdev support. uinput and evdev modules should be
kld-loaded or compiled into the kernel in that case.

bthidd_evdev_support rc.conf variable is added to control enabling of
evdev support in bthidd startup script. Possible values are: "YES", "NO",
"AUTO"(default). Setting bthidd_evdev_support to "AUTO" inserts "-u" option
if kernel is compiled with EVDEV_SUPPORT option enabled.

Support for consumer HID usage page keyboard events is implemented. Most of
them are available only through evdev protocol.

kern.evdev.rcpt_mask sysctl is checked, so "sysctl kern.evdev.rcpt_mask=12"
should be executed if EVDEV_SUPPORT is compiled into kernel.

It is recommended to regenerate bthidd.conf entries with bthidcontrol(8)
"Query" command to set user-friendly names of bluetooth devices.

Reviewed by:	emax, gonzo, wblock (docs), bcr (docs, early version)
Differential Revision:	https://reviews.freebsd.org/D13456
2018-04-30 12:16:54 +00:00
Vladimir Kondratyev
e650806966 bthidd(8): Add internal support for user-friendly name of remote devices.
Extend bthidd.conf format to store name of remote Bluetooth HID devices and
implement querying of this information with bthidcontrol(8) "Query" command.

Reviewed by:		emax
Differential Revision:	https://reviews.freebsd.org/D13456
2018-04-30 10:49:29 +00:00
Pedro F. Giffuni
1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Vladimir Kondratyev
c9eb7bf7a0 bthidd(8): Generate button release event after virtual T-axis button press
Apply PR/213957 (r308165, Make sure the virtual T-axis buttons generate button
release event(s) for continuous tilting) to bluetooth mouse support.

Reviewed by:		emax, gonzo
Approved by:		gonzo (mentor)
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D12672
2017-10-30 20:58:57 +00:00
Vladimir Kondratyev
12df521311 bthidd: Fix leds on multireport keyboards broken after r297217
Reviewed by:		emax, gonzo
Approved by:		gonzo (mentor)
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D12214
2017-10-19 20:42:46 +00:00
Vladimir Kondratyev
a9a8884bf9 bthidd(8): Add support for Apple's magic mouse
Note: Mouse's bthidd.conf record should contain vendor and device IDs
to make proper device detection. If it does not contain IDs,
regenerate record with "Query" command of recent bthidcontrol(8).

Submitted by:		Dirk Engling <erdgeist@erdgeist.org>
Reviewed by:		emax
Approved by:		bapt (mentor), gonzo (mentor)
Differential Revision:	https://reviews.freebsd.org/D3702
2017-08-12 21:23:33 +00:00
Vladimir Kondratyev
6032284eb9 bthidd(8): Add support for vendor_id, product_id and version.
Extend bthidd.conf format to store vendor and product IDs of remote
Bluetooth HID devices to make possible implementation of device
specific quirks inside bthidd(8).
Add support for querying of this information from device's SDP records
with bthidcontrol(8) "Query" command.

Submitted by:		Dirk Engling <erdgeist@erdgeist.org>
Reviewed by:		emax
Approved by:		bapt (mentor), gonzo (mentor)
Differential Revision:	https://reviews.freebsd.org/D3702
2017-08-12 21:20:51 +00:00
Andriy Voskoboinyk
c69b68f502 rfcomm_pppd.8: fix a typo (SPD -> SDP).
MFC after:	3 days
2017-08-06 21:54:43 +00:00
Stephen J. Kiernan
63c1ff65d1 When the input parameter node is NULL, memory is allocated to it.
To later free the memory, introduce a new variable lnode to track when
this happens.

Submitted by:	Thomas Rix <trix@juniper.net>
Reviewed by:	emax
Approved by:	sjg (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9878
2017-06-06 22:17:55 +00:00
Takanori Watanabe
4aa92fe2f3 Make cached Bluetooth LE host advertise information visible from userland.
Differential Revision:	https://reviews.freebsd.org/D10362
2017-04-27 15:03:24 +00:00
Enji Cooper
64a0982bee usr.sbin: normalize paths using SRCTOP-relative paths or :H when possible
This simplifies make logic/output

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-03-04 11:38:03 +00:00
Dimitry Andric
7fcdc815d2 Avoid undefined behavior when calling va_start() in bnep_send_control(),
by making the 'type' parameter a plain unsigned.

MFC after:	3 days
2016-08-29 19:40:46 +00:00
Adrian Chadd
aebdb1e24e [ath3k] add a replacement ath3k firmware loading tool.
This is influenced by the ath3k driver from linux (circa 2013, this is
how long I've been sitting on this.)

It handles loading in firmware using the newer model, where it assembles
the right set of firmware blobs and board configuration based on the
device list and querying the device.

The older utility could only load in a single image - which sometimes
was ath3k-1.fw and sometimes was ath3k-2.fw.  However, the ath3k maintainers
didn't want to keep adding in binaries that were just derivatives with a
separate board config, so they deleted ath3k-2.fw from the Linux firmware
repository and instead, well, did this.

Now, this has been tested against AR3011 and AR3012 NICs from the AR9285+BT
combo up through to the QCA9565+BT combo.  It doesn't yet work with the
QCAFN222 NIC as that is some newer chip.

The firmware can be grabbed from https://github.com/erikarn/ath3kfw/ in
the share/firmware/ath3k directory.  I'll update this utility over time
to support the newer firmware drops (newer than mid-2013) which should
pull in the QCNFA222 and subsequent chips.

Tested:

* AR9285 + BT
* AR9287 + BT
* AR9485 + BT
* AR9462 + BT
* QCA9565 + BT
2016-06-07 04:22:18 +00:00
Marcelo Araujo
d134fb49e5 For pointers use NULL instead of 0. 2016-06-06 04:18:56 +00:00
Alan Somers
8907f744ff Improve performance and functionality of the bitstring(3) api
Two new functions are provided, bit_ffs_at() and bit_ffc_at(), which allow
for efficient searching of set or cleared bits starting from any bit offset
within the bit string.

Performance is improved by operating on longs instead of bytes and using
ffsl() for searches within a long. ffsl() is a compiler builtin in both
clang and gcc for most architectures, converting what was a brute force
while loop search into a couple of instructions.

All of the bitstring(3) API continues to be contained in the header file.
Some of the functions are large enough that perhaps they should be uninlined
and moved to a library, but that is beyond the scope of this commit.

sys/sys/bitstring.h:
        Convert the majority of the existing bit string implementation from
        macros to inline functions.

        Properly protect the implementation from inadvertant macro expansion
        when included in a user's program by prefixing all private
        macros/functions and local variables with '_'.

        Add bit_ffs_at() and bit_ffc_at(). Implement bit_ffs() and
        bit_ffc() in terms of their "at" counterparts.

        Provide a kernel implementation of bit_alloc(), making the full API
        usable in the kernel.

        Improve code documenation.

share/man/man3/bitstring.3:
        Add pre-exisiting API bit_ffc() to the synopsis.

        Document new APIs.

        Document the initialization state of the bit strings
        allocated/declared by bit_alloc() and bit_decl().

        Correct documentation for bitstr_size(). The original code comments
        indicate the size is in bytes, not "elements of bitstr_t". The new
        implementation follows this lead. Only hastd assumed "elements"
        rather than bytes and it has been corrected.

etc/mtree/BSD.tests.dist:
tests/sys/Makefile:
tests/sys/sys/Makefile:
tests/sys/sys/bitstring.c:
        Add tests for all existing and new functionality.

include/bitstring.h
	Include all headers needed by sys/bitstring.h

lib/libbluetooth/bluetooth.h:
usr.sbin/bluetooth/hccontrol/le.c:
        Include bitstring.h instead of sys/bitstring.h.

sbin/hastd/activemap.c:
        Correct usage of bitstr_size().

sys/dev/xen/blkback/blkback.c
        Use new bit_alloc.

sys/kern/subr_unit.c:
        Remove hard-coded assumption that sizeof(bitstr_t) is 1.  Get rid of
        unrb.busy, which caches the number of bits set in unrb.map.  When
        INVARIANTS are disabled, nothing needs to know that information.
        callapse_unr can be adapted to use bit_ffs and bit_ffc instead.
        Eliminating unrb.busy saves memory, simplifies the code, and
        provides a slight speedup when INVARIANTS are disabled.

sys/net/flowtable.c:
        Use the new kernel implementation of bit-alloc, instead of hacking
        the old libc-dependent macro.

sys/sys/param.h
        Update __FreeBSD_version to indicate availability of new API

Submitted by:   gibbs, asomers
Reviewed by:    gibbs, ngie
MFC after:      4 weeks
Sponsored by:   Spectra Logic Corp
Differential Revision:  https://reviews.freebsd.org/D6004
2016-05-04 22:34:11 +00:00
Pedro F. Giffuni
beb45c4fd4 bluetooth: minor spelling fixes.
User-visible strings.

MFC after:	2 weeks
2016-05-01 16:36:14 +00:00
Maksim Yevmenkin
52a4455b80 fix incorrect usage of hid_set_data() which causes crash
in bthidd(8) on amd64 WITH_SSP builds

Submitted by:	rakuco
Reviewed by:	rakuco
Tested by:	rakuco
MFC after:	1 week
2016-03-23 22:07:13 +00:00
Bryan Drewery
bd18fd57db DIRDEPS_BUILD: Regenerate without local dependencies.
These are no longer needed after the recent 'beforebuild: depend' changes
and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports
skipping 'make depend'.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:20:11 +00:00
Hans Petter Selasky
d6c5363360 Fix scancodes for Kana and Eisu keys.
PR:		204709
Submitted by:	naito.yuichiro@gmail.com
MFC after:	3 days
2015-11-21 21:14:16 +00:00
Maksim Yevmenkin
f32d9c4bd3 check boundaries while parsing SDP responses
Reported by:	hps
Reviewed by:	hps
MFC after:	1 week
2015-10-20 18:01:08 +00:00
Takanori Watanabe
05e526fb5a fix compare argument for address type.
Submitted by: issei10193 (via Twitter)
2015-09-09 13:24:39 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Warner Losh
4d57a59a83 Remove stray DEBUG_FLAGS=-g that snuck in with r137868 2015-05-21 14:36:15 +00:00
Enji Cooper
d7f46fbd10 ath3kfw, bcmfw, bthidcontrol, bthidd all require usb(4); build them
conditionally if MK_USB != no

MFC after: 1 week
2015-04-27 06:34:51 +00:00
Takanori Watanabe
4cae2db2a8 To ensure j formatting string valid, cast uint64_t values to uintmax_t. 2015-04-18 17:41:09 +00:00
Takanori Watanabe
4315b1cb29 Change printf formatting to unbroke i386 arch.
Submitted by:david@catwhisker.org
2015-04-18 16:04:32 +00:00
Takanori Watanabe
bf9b5107ef Fix Typo. 2015-04-18 09:08:47 +00:00
Marcelo Araujo
af5c4f8b4b Fix misspelling. 2015-04-18 06:53:13 +00:00
Marcelo Araujo
9c3471fa12 Improve code style(9), no functional changes.
Differential Revision:	D2320
Reviewed by:		takawata
2015-04-18 06:48:03 +00:00
Takanori Watanabe
bcff2d9100 Add LE related HCI control command to hccontrol(1). 2015-04-18 04:53:17 +00:00
Takanori Watanabe
bb9157d5e3 Accept LE event on hccontrol socket. 2015-04-12 15:08:41 +00:00
Takanori Watanabe
4bb0556352 Add HCI/LMP revision information. 2015-04-12 14:38:18 +00:00
Takanori Watanabe
8d6f425ddd Check l2cap socket initialisation and define L2CAP_SOCKET_CHECKED
This will fix build.
2015-04-07 16:48:23 +00:00
Raphael Kubo da Costa
fe4313f887 bthidd: Remove unused macros from hid.c.
ASIZE() was never used, and min() stopped being used in r207812.

Differential Revision:	https://reviews.freebsd.org/D2230
Reviewed by:	emax
Approved by:	emax
MFC after:	1 week
2015-04-06 12:36:24 +00:00
Raphael Kubo da Costa
822a51b396 bthidd: Consider usage ranges when dealing with array inputs.
So far, we were always using HID_USAGE() to determine the Usage ID of a
certain HID report input item. This does not work as intended if a field
is an array and the allowed usages are specified with a usage range, as
HID_USAGE() will return 0. We need to use the field value as an index in
the usage range list in this case instead.

This makes the volume keys in a Microsoft Bluetooth Mobile Keyboard
5000 be properly recognized. The relevant part of the HID report looks
like this:

  0xA1, 0x01,        // Collection (Application)
  0x85, 0x07,        //   Report ID (7)
  0x05, 0x0C,        //   Usage Page (Consumer)
  0x19, 0x00,        //   Usage Minimum (Unassigned)
  0x2A, 0xFF, 0x03,  //   Usage Maximum (0x03FF)
  0x95, 0x01,        //   Report Count (1)
  0x75, 0x10,        //   Report Size (16)
  0x15, 0x00,        //   Logical Minimum (0)
  0x27, 0xFF, 0x03, 0x00, 0x00,  //   Logical Maximum (1023)
  0x81, 0x00,        //   Input (Data,Array,Abs,No Wrap,Linear,Preferred
                     //   State,No Null Position)

When a key such as "volume down" is pressed, the following data is
transferred through Interrupt In:

  0x07 0xEA 0x00

Differential Revision:	https://reviews.freebsd.org/D2229
Reviewed by:	emax
Approved by:	emax
MFC after:	1 week
2015-04-05 18:53:48 +00:00
Edward Tomasz Napierala
2a0ed0760c Make hccontrol(8) and sdpcontrol(8) appear in "man -k bluetooth" output.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-02-07 14:31:51 +00:00
Joel Dahl
914f6e6290 mdoc: sort SEE ALSO. 2014-12-26 21:56:23 +00:00
Maksim Yevmenkin
3cf34fa5f7 handle "Kana" and "Eisu" keys on Apple Wireless Keyboard (JIS)
PR:		187470
Submitted by:	naito.yuichiro
MFC after:	1 week
2014-12-11 18:08:54 +00:00
Baptiste Daroussin
c6db8143ed Convert usr.sbin to LIBADD
Reduce overlinking
2014-11-25 16:57:27 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Baptiste Daroussin
01c2b8ac0d use .Mt to mark up email addresses consistently (part2)
PR:		191174
Submitted by:	Franco Fichtner  <franco@lastsummer.de>
2014-06-20 09:57:27 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Joel Dahl
7e700c30d2 mdoc: minor paragraph fixes. 2014-02-08 13:37:02 +00:00