Commit graph

59 commits

Author SHA1 Message Date
G Derber
f7761fd635
Add ability to differentiate group ownership from user ownership. 2024-08-06 09:38:25 -04:00
cmitu
ba2cb3ed7a bluetooth: fix PS3 pairing with recent BlueZ
Due to changes in BlueZ added to fix CVE-2023-45866, the PS3 controllers won't pair/work anymore with BlueZ.
Since the path consist in only one change to default option (ClassicBondedOnly default changed, see [1]), it's been quickly added by all distros [2], [3].
This has already been reported in the forums and fixed (for Buster) by downgrading the `bluez` package. The same fix cannot be applied to current distros, so we can switch back the option to the way it works with PS3 controllers.

NOTE:
 * while technically this make BlueZ vulnerable to CVE-2023-45866, the exploit mentioned works IIF BlueZ is set to 'discoverable' mode.
However, this mode is set only during discoveries, which in RetroPie means just the pairing dialog - I think the risk for a real break-in through the vulnerability described is very low. See [4] for an explanation of the conditions needed to exploit it on BlueZ and a PoC (which didn't work for me, despite having the vulnerable config in place).
 * the configuration is set-up only when a PS3 pairing attempt is made.
 * when removing a device, the vulnerable configuration will also be removed if no more PS3 paired devices are left.

[1] https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/profiles/input?id=25a471a83e02e1effb15d5a488b3f0085eaeb675
[2] https://ubuntu.com/security/CVE-2023-45866
[3] https://security-tracker.debian.org/tracker/CVE-2023-45866
[4] https://github.com/marcnewlin/hi_my_name_is_keyboard?tab=readme-ov-file#linux-keystroke-injection
2024-03-26 19:08:07 +00:00
cmitu
fbc3d1df8e bluetooth: updates for python3
Updated the dependencies and scripts for python3:

* `python-dbus` no longer exists in Debian 11 'bullseye' or Ubuntu > 20.04, installl the `python3` version
* `python-gobject` has been superseeded by `python(3)-gi`, the current package is just a transitional package that pulls
`python-gi` and the old `python-gobject-2` (deprecated). Update the dependencies and the scripts to use the new package.
* set python3 as interpreter for the helper scripts. Fixed the dict syntax for getting items
2021-11-15 06:43:20 +00:00
Jools Wills
19c273bb21 bluetooth - register -> pair naming and use paired list for connect functionality
Also change status output to use - not : to avoid confusion with mac address
2020-12-17 06:47:22 +00:00
Jools Wills
c20d4fce99 bluetooth - connect function was broken 2020-12-17 06:47:22 +00:00
Jools Wills
4fa5127ed8 bluetooth - variable name shortening for readability
mac_addresses arrays to devices
mac_address to mac
device_name to name
2020-12-17 06:47:22 +00:00
Jools Wills
131a1c83bb bluetooth - registered / paired device logic rework
I made some changes before to hide previously registered devices from the connect menu, to make it
easier when dealing with multiple devices of the same name. However due to the way bluetoothctl works,
previously "seen" devices are added to the system, meaning devices that are not paired are registered and cached,
and then won't be shown again.

This changeset addresses the following:

Only actually paired devices will be hidden from the register and connect menu

New functions list_paired and list_connected have been added

Switched to use bt-device to check for connected devices for consistency. Private function handles
grepping for Paired or Connected via bt-device --info

display_active_and_registered function renamed to simpler status and reworked to use the new functions.
It outputs to console - the GUI menu just calls this and then outputs to a dialog menu - making this now
a more useful commandline function

remove_device shows all registered devices, even ones seen before. These previously seen devices show
up when scanning so we still want to be able to remove them. I have adjusted it though so paired devices are
shown first, followed by any known devices.
2020-12-17 06:47:22 +00:00
Jools Wills
508d50b8ee bluetooth - redirect errors from systemctl check to avoid output when no service installed 2020-06-24 03:05:10 +01:00
Jools Wills
75dac05e39 bluetooth - do a dependency check / install in update hook for users with boot/background mode
* previous configs with connect_mode set to boot/background could fail due to missing dependencies after recent bluez-tools changes
2020-06-24 00:14:16 +01:00
Jools Wills
57bfd733dd bluetooth - split out boot bluetooth connect script from main code
* running RetroPie-Setup on boot isn't efficient / it should work without RetroPie-Setup present.
 * running it as root on boot causes /opt/retropie/configs/all to be chowned to root due to setupDirectories call
2020-06-22 02:39:26 +01:00
Jools Wills
a15d58a836 bluetooth - use bt-device from bluez-tools for over old python code
* added bluez-tools dependency
 * use bt-device for Trusting / Connecting / Removing of devices
2020-06-22 02:39:21 +01:00
Jools Wills
411b4eb17d bluetooth - only show unregistered devices when scanning to simplify use
Before when looking for devices to pair with, previously registered devices could be shown
which can make it confusing with multiple gamepads with the same name as to which to add
2019-12-13 02:31:23 +00:00
Conn O'Griofa
8ee9dbc985 sixaxis: implement sixaxis driver helper
* Installs multi-instance systemd service, triggered via udev
  rules matching supported Sixaxis-compatible pads
* Configure fuzz on analog axes to mitigate erratic resting state values
* When connecting via Bluetooth, implement idle disconnect based on event
  activity (needed due to BlueZ's sixaxis plugin not respecting the
  IdleTimeout setting).
2019-02-28 02:38:55 +00:00
Conn O'Griofa
7acb4253a0 bluetooth: improve DualShock USB security authentication support 2019-02-26 02:22:16 +00:00
Conn O'Griofa
e523c68ab4 bluetooth: use associative arrays for MAC addresses 2019-02-26 01:41:26 +00:00
Conn O'Griofa
6ce74e997e bluetooth: improve scan timeout functionality
Ensure that bluetoothctl will never cause the script to hang due to
infinitely repeating status change messages.

Also reduce timeout to 15 seconds and clarify DualShock instructions;
the PS button needs to be pressed if the controller is still scanning
during cable connect to ensure it binds to the USB connection.
2019-02-20 03:59:39 +00:00
Jools Wills
58e2a7d6c3 bluetooth - don't skip registration for devices that are trusted
* fixes pairing bluetooth controllers
2019-02-07 20:54:21 +00:00
Conn O'Griofa
12cb7eb1bc bluetooth: improve BlueZ 5.50+ & sixaxis compatibility
All changes are compatible with Raspbian stretch's default
BlueZ version.

bluez_cmd_bluetooth:
* enable default-agent during general scan
* fix compatibility with BlueZ 5.50-1 userspace tools
* improved reliability when sending multiple commands

sixaxis:
* ensure both authorization & trust is performed to account for
  different BlueZ behaviour between versions
* force-disconnect Bluetooth connection upon first registration to
  avoid controller hang caused by USB input claim conflict

general:
* increase scan time to 20 seconds
* silence sixad messages
2019-02-03 02:35:13 +00:00
Conn O'Griofa
9829d24155 bluetooth: support sixaxis Bluetooth pairing
Add information to the default Bluetooth scanning prompt when the hid-sony driver is loaded,
and reply to Bluetooth authorization prompt to allow successful pairing.
2018-04-10 06:10:26 +00:00
Conn O'Griofa
93c4ab9be2 bluetooth: make bluez support more robust
Use same FIFO to send and receive output, and improve compatibility
with BlueZ 5.48's modified bluetoothctl command line behaviour.
2018-03-14 21:03:40 +00:00
Conn O'Griofa
424fd11b09 bluetooth: fix bluez 5.43 compatibility
It's necessary to read more characters per line to match the "[bluetooth]" string due to commit:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/?id=6fd2662dc96ccf5fc194c53d5c6f90431ba9f8a5

Fixes bluetooth on stretch.
2017-10-12 16:02:59 +00:00
Jools Wills
042cdef9ac variable quoting 2017-09-19 15:36:32 +01:00
Conn O'Griofa
3ac9e3bebf ps3controller: clarify Bluetooth stack compatibility
* Remove obsolete information that driver breaks Bluetooth and replace
  with warning that Bluetooth pairing works in RetroPie menu, but cannot
  be guaranteed elsewhere.
* Add notice after exiting Bluetooth menu (only when sixad is running)
  informing users to re-pair controller, to hopefully reduce confusion.
2017-09-10 02:07:17 +01:00
Conn
88008daf37 Bluetooth: enhance sixad compatibility
Re-enable bluetoooth stack in Bluetooth dialog menu, and restart
sixad daemon upon exit.

This allows standard BT device pair/unpair management with DS3
controller fully working in-menu. The only drawback is that
your PS3 controller will turn off upon exiting the menu due to the
daemon restart.
2017-07-16 02:33:14 +01:00
Jools Wills
04c4438848 more consistent sed parameters (just drop the -e) 2017-05-04 20:10:57 +01:00
Jools Wills
81db01b3e0 bluetooth - bluetooth connect mode wording 2017-04-04 04:28:49 +01:00
Jools Wills
a49d715373 remove Raspbian wheezy support 2016-12-24 20:15:43 +00:00
Jools Wills
a721b2833b autoconf - default 8bitdo_hack to off 2016-11-25 16:19:52 +00:00
Jools Wills
5e369663b7 styleguide / cleanups 2016-11-13 23:32:34 +00:00
Jools Wills
f5ffcfa631 add a new md_data variable for quick access to a modules additional data files 2016-10-19 21:56:38 +01:00
Jools Wills
204e9cf9c1 update modules to use new __os_* variables 2016-10-09 05:50:40 +01:00
Jools Wills
97d7d585f6 bluetooth - correct bluetooth.cfg location 2016-09-02 00:57:37 +01:00
Jools Wills
7f8b1bd062 bluetooth configuration improvements
* deal with RequestConfirmation responses - ignore errors from the python script and just check connection as it seems to pair and connect despite reporting problems. may help #1611
2016-08-05 00:46:23 +01:00
Jools Wills
45ebec12ee 8bitdo mapping improvements
* add autoconf.cfg parameter 8bitdo_hack (default 1) to decide whether to add the offset to the inputs for retroarch - which is required on the older firmware
 * make sure autoconf.cfg is owned by $user - it would be created as root previously
 * add setAutoConf function
 * cleanup retroarch config generation code
2016-07-16 16:42:26 +01:00
Jools Wills
5f3902cf85 bluetooth background connect changes
* background connect to devices only if they are not already connected
 * use bluetoothctl rather than the python code
2016-07-09 18:52:12 +01:00
Jools Wills
bf3b99e482 bluetooth - wait for 10 seconds when scanning, and display dialog 2016-06-16 03:32:33 +01:00
Jools Wills
b40370c894 bluetooth - add missing agents/security modes - might be useful 2016-06-16 03:27:18 +01:00
Jools Wills
6e2a9aeabf bluetooth improvements
* support connecting to devices in background
 * use letters for main menu - saves renumbering etc
 * cleanups / fixes
 fixes #1526
2016-06-13 18:19:09 +01:00
Jools Wills
287f9e9eaf bluetooth - oops. broke registering/pairing by duplicating a function name. should fix #1524 - thanks floob 2016-06-13 01:18:38 +01:00
Jools Wills
6fc6967ba4 bluetooth connect on boot menu fixes 2016-06-12 05:53:32 +01:00
Jools Wills
23ddbadb9f bluetooth improvements -
* ability to connect to all registered devices from the bluetooth module
 * optional systemctl service that will connect to all registered devices on boot
2016-06-12 05:19:59 +01:00
Jools Wills
8dd2069660 use config instead of conf 2016-06-06 22:08:36 +01:00
Jools Wills
889f8ecdfa Initial rewrite of the setup menu, including per package/module management
* rp_module_menus is no more - instead use rp_module_section with one of
   - core (core packages)
   - main (main packages - which will be installed by default in the image)
   - opt (optional packages)
   - exp (experimental packages)
   - driver (driver packages)
   - config (configuration packages / tools)

 * The setup menu organises the data based on the above sections. more could be added in the future if needed. Packages (internally modules), can be added / configured / removed individually, or as entire sections.

 * The setup menu will automatically detect if a binary is available to be installed. the nobin flag is no longer needed. modules that install directly from binary via aptInstall or via a prebuilt binary need to use an install_bin_ function instead of install_

 * rp_module_section of type "config" will have the "gui_" function called first if it's available, otherwise a standard depends/sources/build/install/configure will be called

 * configure is no longer used for "gui" configuration function - use gui_ instead. Had already started to move to this before, but now it is required.
2016-06-06 22:08:36 +01:00
Jools Wills
958bca449b bluetooth changes
* add menu entry to allow automatic set up of udev rules for 8bitdo joypads (or any others that require it).
2016-06-06 21:57:13 +01:00
gizmo98
fed5d9c6c1 bluetooth: fix connection problems
Add necessary package rapberrypi-sys-mods.
2016-05-21 12:24:45 +02:00
Jools Wills
f2836349d5 install pi-bluetooth package on raspbian jessie for rpi3 2016-03-02 19:25:34 +00:00
Jools Wills
2ee3590a44 rename remove_bluetooth to remove_device_bluetooth 2016-02-22 14:14:29 +00:00
Jools Wills
63bccc25e9 enable bluetooth module for x86 (it works depite the fact that the X tools are better) and add to retropiemenu 2016-02-05 00:44:12 +00:00
Jools Wills
46ff7b3a3c fix display of registered bluetooth devices on jessie and clean up code 2016-01-23 03:17:23 +00:00
Jools Wills
e5b44d5e53 added python-gobject dependency to the bluetooth module 2016-01-20 03:09:56 +00:00