Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on: [pull_request]

jobs:
ci:
runs-on: ubuntu-latest
name: CI for Pull Request
steps:
- name: Checkout the source code
uses: actions/checkout@v3
with:
path: src/src

- name: CI
uses: tedd-an/bzcafe@main
with:
task: ci
base_folder: src
space: user
github_token: ${{ secrets.ACTION_TOKEN }}
email_token: ${{ secrets.EMAIL_TOKEN }}
patchwork_token: ${{ secrets.PATCHWORK_TOKEN }}
patchwork_user: ${{ secrets.PATCHWORK_USER }}

26 changes: 26 additions & 0 deletions .github/workflows/code_scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Code Scan

on:
schedule:
- cron: "40 7 * * FRI"

jobs:
code-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout the source
uses: actions/checkout@v2
with:
fetch-depth: 0
path: src
- name: Code Scan
uses: BluezTestBot/action-code-scan@main
with:
src_path: src
github_token: ${{ secrets.GITHUB_TOKEN }}
email_token: ${{ secrets.EMAIL_TOKEN }}
- uses: actions/upload-artifact@v2
with:
name: scan_report
path: scan_report.tar.gz

43 changes: 43 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Sync

on:
schedule:
- cron: "*/30 * * * *"

jobs:
sync_repo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: master

- name: Sync Repo
uses: tedd-an/bzcafe@main
with:
task: sync
upstream_repo: 'https://git.kernel.org/pub/scm/bluetooth/bluez.git'
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Cleanup PR
uses: tedd-an/bzcafe@main
with:
task: cleanup
github_token: ${{ secrets.ACTION_TOKEN }}

sync_patchwork:
needs: sync_repo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Sync Patchwork
uses: tedd-an/bzcafe@main
with:
task: patchwork
space: user
github_token: ${{ secrets.ACTION_TOKEN }}
email_token: ${{ secrets.EMAIL_TOKEN }}
patchwork_token: ${{ secrets.PATCHWORK_TOKEN }}
patchwork_user: ${{ secrets.PATCHWORK_USER }}

29 changes: 29 additions & 0 deletions profiles/input/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ struct input_device {
bool virtual_cable_unplug;
uint8_t type;
unsigned int idle_timer;
bool sdp_rediscover;
};

static int idle_timeout = 0;
Expand Down Expand Up @@ -1062,6 +1063,22 @@ static gboolean encrypt_notify(GIOChannel *io, GIOCondition condition,
return FALSE;
}

static void input_device_update_rec(struct input_device *idev);
static int hidp_add_connection(struct input_device *idev);

static void hidp_sdp_cb(struct btd_device *dev, int err, void *user_data)
{
struct input_device *idev = user_data;

DBG("");

/* Attempt to update SDP record if it had changed */
input_device_update_rec(idev);

if (hidp_add_connection(idev) < 0)
btd_service_disconnect(idev->service);
}

static int hidp_add_connection(struct input_device *idev)
{
struct hidp_connadd_req *req;
Expand All @@ -1078,6 +1095,18 @@ static int hidp_add_connection(struct input_device *idev)
if (err < 0) {
error("Could not parse HID SDP record: %s (%d)", strerror(-err),
-err);
if (err == -ENOENT && !idev->sdp_rediscover) {
err = device_discover_services(idev->device);
if (err < 0) {
error("Could not discover services: %s (%d)",
strerror(-err), -err);
goto cleanup;
}

idev->sdp_rediscover = TRUE;
device_wait_for_svc_complete(idev->device,
hidp_sdp_cb, idev);
}
goto cleanup;
}

Expand Down
7 changes: 5 additions & 2 deletions src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -6271,10 +6271,13 @@ int device_discover_services(struct btd_device *device)
{
int err;

if (device->bredr)
if (device->bredr) {
device->bredr_state.svc_resolved = FALSE;
err = device_browse_sdp(device, NULL);
else
} else {
device->le_state.svc_resolved = FALSE;
err = device_browse_gatt(device, NULL);
}

if (err == 0 && device->discov_timer) {
timeout_remove(device->discov_timer);
Expand Down