Commit Graph

82 Commits

Author SHA1 Message Date
Augustin Cavalier bb83316a58 L2CAP: Major refactor of the whole component.
(And surrounding portions of the "btCoreData" module.)

 * Rewrote the main "l2cap.h" header representing protocol constants
   and structures. Now conforms to general Haiku naming conventions
   rather than BSD ones. Some more constants added/removed based
   on the most recent Bluetooth specification.

 * Rewrote all code derived from the BSDs to match Haiku conventions
   and structures in the driver.

 * Dropped the "channel" and "frame" structures from "btCoreData".
   Channels are now managed by L2capEndpoints, and "frames" are
   now just plain net_buffers without surrounding structures.
   This also makes state management much simpler.

 * Made it so that actual net_buffers are passed through to the
   l2cap_receive function rather than another data structure.
   A fake interface address is used to communicate connection
   information. (This probably ought to be changed, though.)

 * Get rid of l2cap_lower and l2cap_upper abstractions.
   Everything related to channel/endpoint management is now
   done in L2capEndpoint, while buffer reception is handled
   directly in l2cap_receive and elsewhere, same as other drivers.

 * Wire up more hooks and fix module flags (needed to be able to
   get the module loaded and opening sockets at all.)

 * Implement an actual locking strategy in L2capEndpoint
   and HciConnection. There's still problems with lifetime
   management, but at least thread-safety is mostly handled.

 * Create an L2capEndpointManager and use it to manage
   the endpoints, rather than having a single (unsafe)
   linked-list.

And plenty of other refactorings and cleanups besides.
There's still more to be done for Bluetooth overall, though:

 * The "btCoreData" and "hci" modules also badly need a major
   overhaul, and should be merged into a single "bluetooth"
   bus_manager. They also shouldn't be passing around pointers
   to other modules like this.

 * There's a number of TODOs/FIXMEs in the L2CAP module, most
   notably around timeouts (especially command timeouts) and
   parameter validation/specification.

Tested by myself with kallisti5's help. Incoming connections
(on the PSM for SDP) get all the way to the latter half
of the Configuration step before hanging.
2024-05-01 00:25:43 -04:00
Augustin Cavalier 2897df9676 bluetooth: ioctls always pass size on Haiku. 2018-11-18 14:42:09 -05:00
Adrien Destugues a5a3b2d9a3 Bluetooth: fix thread safety issue.
Fixes #11428.
2016-02-14 14:07:21 +01:00
Jérôme Duval e5d65858f2 Fix more GCC4 narrowing conversion warnings.
* Code style would be to fix.
2013-05-03 19:42:04 +02:00
Fredrik Modéen 7a74a5df45 WIP... Updating Bluetooth.
* Some bugfixes.
* added scan mode read.
* inactivated some printout for now. Was a lot of noice in terminal
2012-08-27 19:23:22 +00:00
Oliver Tappe 269ebc04b9 Fix #6373, second try
* make BDADDR_* macros refer to value types instead of addresses
* adjust all interfaces using bdaddr_t* to use (mostly const) refs instead,
  which IMHO makes the interface & code clearer
* that got rid of a couple of const incorrectness casts
* some cleanup along the way


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38265 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-19 15:29:02 +00:00
Oliver Tappe 32a2294fdc * revert r38213, as it introduces initialization problems
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38263 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-19 14:40:17 +00:00
Oliver Tappe e0ef64750f * fix #6373 by switching the BD... macros to take the address of corresponding
constants, which had to be defined in several places in order to be available
  in the kernel addons, network protocols and the server/kit.
* enable -Werror for all servers

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38213 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-17 21:46:32 +00:00
Oliver Ruiz Dorantes a5bf12376d *Incorrect endianess handling from bdaddr at parsing from string.
*Remove bluetooth_util deprecated header
*Issue conn_req for socket connect() call



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37132 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-06-14 20:04:10 +00:00
Oliver Ruiz Dorantes 125183f9e5 - Add possibility yo set a custom friendly name to our device. Which will be seen by remotes devices at discovery
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36729 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-07 18:25:09 +00:00
Oliver Ruiz Dorantes ddbc9a0f2a - I expected once Haiku sets a connection with a remote device, such connection
was to expire in a couple of minutes, but not, seems to stay forever.
- Implement a Disconnect button in prefrences&kit



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36450 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-24 16:01:08 +00:00
Oliver Ruiz Dorantes 36cb67b24e - Style: alphabetize include directives
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36449 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-24 13:16:13 +00:00
Oliver Ruiz Dorantes 37c7d5d83a LocalDevice:
- Implement REading of the default timeouts
- Retrieval of all possible LinkKeys stored inside the dongle
- Provided function to force an authentication process with remote devices
RemoteDevice:
- Allow Haiku initiate a fully authenticated connection



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36445 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-24 11:34:23 +00:00
Oliver Ruiz Dorantes 62f5ba006a - Read Local features al LocalDevice constructor
- keep record in UL and KL side



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36027 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-02 12:12:29 +00:00
Oliver Ruiz Dorantes 9760dcae20 - Move bluetooth net_device module to a independent module HCI, remake API interfaces
- Move functionality for assembling ACL/events packets of the driver to this module
- Move h2generic driver to c++ (not style)
- Pass checkstyle.py to all commited files.
Fixes:
- Wrong condition for finishing l2cap packet segmentation.
- Place NetBuffersPrependers in a inner scope to avoid Sycing twice in destructor.
- Avoid keeping trace of l2cap responses of any other kind of thread.
- Do not free net_buffers of for Frame containers.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35117 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-17 15:46:36 +00:00
Oliver Ruiz Dorantes 981f1b1135 - Add method in LocalDevice class to write its class to the dongle
- Rework and style the DeviceClass class
- Implement option "Identify host as..." in preferences with mentioned method, this should allow us to be visible to more RemoteDevices



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31502 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-10 14:19:17 +00:00
Oliver Ruiz Dorantes ddac407426 - Add initial code to unregister devices from server
- Handle Hardware error event
- Add function to retrieve an string from a bluetooth error
- Styling



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31376 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-02 20:07:26 +00:00
Oliver Ruiz Dorantes a1163de83e - Long events were locking the bluetooth server, as events can be more than 256 counting with the header.
- Add debug more information in H2 driver and Command Status event
- Change name of port for posting events(former was too long)



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31036 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-13 19:17:10 +00:00
Oliver Ruiz Dorantes 155fa31ec6 - Add method in DeviceClass to draw something representative for the kind of device
- Adopt it in Preferences
(Joerg Meyer & me)



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30405 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-25 18:40:00 +00:00
Oliver Ruiz Dorantes b9068dbf95 - Change LocalDevice getter for HCI id
- Fix some new some std::nothrow on critical allocations among kit and server
- Some styling



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30353 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-23 18:47:01 +00:00
Oliver Ruiz Dorantes 3a75fb9c85 style
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30306 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-21 21:36:37 +00:00
Oliver Ruiz Dorantes b09fa0e435 - Fix Jamfile
- Avoid constructor in parent class



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30303 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-21 20:59:47 +00:00
Oliver Ruiz Dorantes c3053cacff - Add candidate interface for addons with custom configuration for LocalDevices.
- Add example implementation for Devices which need issue a Reset Command



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30300 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-21 20:04:24 +00:00
Oliver Ruiz Dorantes 1b80286772 Move GetID to public API
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30298 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-21 18:21:40 +00:00
Oliver Ruiz Dorantes d081e691a0 - Add Strings for bluetooth events
- Use then in bluetooth server output



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29750 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-28 01:03:05 +00:00
Oliver Ruiz Dorantes dd5df90570 - Remove size output parameter creating commands
- Add support for reading the size of internals buffers of the bt chips
- Add support for Resetting the Device
- Add broadcom vendor command fro writting the bdaddr
- clean up the debug output



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29669 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-23 23:07:07 +00:00
Oliver Ruiz Dorantes 3fdaa5bf72 - Drop R5 compatibility by removing first 4 bytes in the IOCTLs containing the size of the command.
- Implement mechanism GetProperty to retrieve detailed information about the LocalDevice
- Generic BluetoothDevice interface changed and adapted
- Implement ReadLocalVersion to be aware of the bluetooth specification supported by our localdevice



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29639 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-21 21:38:00 +00:00
Oliver Ruiz Dorantes bd88ac9707 - Move and implement some helper functions to a non private header(revision version etc)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29637 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-21 21:18:51 +00:00
Oliver Ruiz Dorantes d834120754 Show BluetoothAdress in correct order
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29474 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-11 21:26:21 +00:00
Oliver Ruiz Dorantes fa262f2273 Add prototypes to keep/use global Inquiry time
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29264 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-20 18:25:41 +00:00
Oliver Ruiz Dorantes e5da0ec57e some cleanups and styling by Mika and me
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28915 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-16 20:32:19 +00:00
Oliver Ruiz Dorantes 515e878c43 Add method to dump all DeviceClass information in one single string
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28814 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-12-14 16:22:22 +00:00
Oliver Ruiz Dorantes 33fe7b32db - Implement retrieval of Device Classes.
- Implement DeviceClass for easy analisys of discovered devices's type.
- Make harder the intantiation of RemoteDevices.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28809 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-12-13 23:41:32 +00:00
Oliver Ruiz Dorantes 07e4b460ce Add flow specificacion command. Add port names being used among the Stack.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28106 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-14 20:34:30 +00:00
Oliver Ruiz Dorantes 85ce690475 Remove warning, use the common util function for the bdaddr utils class
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26983 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-15 19:08:48 +00:00
Oliver Ruiz Dorantes 8bd7491914 Commit the file i forgot yesterday (ioctl change and cleanups)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26831 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-05 22:12:24 +00:00
François Revol 6ac63f933f - fix warning
- fix build (weird ioctl name)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26811 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-04 23:18:03 +00:00
Oliver Ruiz Dorantes 20a5113818 - Proper const use
- Styling



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26802 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-04 19:10:43 +00:00
Oliver Ruiz Dorantes af9ccaf254 Use const reference as input parameter as suggested by julun
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26801 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-04 17:58:09 +00:00
Oliver Ruiz Dorantes 8976dbe878 - First steps for SCO connections
- Some styling 
(Mika Lindqvist)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26799 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-04 17:14:06 +00:00
Oliver Ruiz Dorantes 001662ae04 A bit more styling on main headers
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26743 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-02 21:15:02 +00:00
Oliver Ruiz Dorantes ceddc28636 Bring to the stack the LinkKey datatype by Mika Lindqvist
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26707 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-31 21:11:42 +00:00
Oliver Ruiz Dorantes 26e7ba5602 More Stylistic changes
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26705 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-31 21:08:27 +00:00
Oliver Ruiz Dorantes b48fa68ace Fix bluetooth_server debug window tabs, they were getting out of bounds due the index assignation
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26704 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-31 21:03:17 +00:00
Oliver Ruiz Dorantes 0f9aa9c245 Patch by Fredrik Ekdahl. Fix tabs and whitespaces, this set of files were conflicting
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26702 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-31 19:55:13 +00:00
Oliver Ruiz Dorantes ded3259257 Patch by Fredrik Ekdahl. Fix tabs and whitespaces
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26701 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-31 19:51:16 +00:00
Oliver Ruiz Dorantes 76646d9f67 Cleanups
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26615 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-24 20:54:32 +00:00
Oliver Ruiz Dorantes 0a95b2a34b An automatic way to define max number of packet types
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26475 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-17 20:38:09 +00:00
Oliver Ruiz Dorantes 870ae24a6d Resolve allocation of multiple Messengers,(Mika Lindqvist)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26449 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-16 19:04:53 +00:00
Oliver Ruiz Dorantes d04eb939af -Move the launching of the Local Device to an IOCTL from the open hook to be more compatible with the net_stack
-Implement Launch method in the accesors regarding previous comment
-Fix KDL at removing device



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26345 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-09 17:01:30 +00:00