Skip to content

Commit 744a20c

Browse files
author
Raz Ben Hemo
committed
Merge branch 'main' of https://github.com/OpenDevicePartnership/embedded-services into personal/razbenhemo/hid_device_handle_cmds
2 parents e6de8c1 + cf625d6 commit 744a20c

File tree

126 files changed

+3029
-1858
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+3029
-1858
lines changed

.github/workflows/cargo-vet.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ permissions:
33
contents: read
44
on:
55
pull_request:
6+
workflow_call:
7+
inputs:
8+
download-lockfiles:
9+
required: false
10+
type: boolean
11+
default: false
612

713
concurrency:
814
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -29,18 +35,23 @@ jobs:
2935
run: echo "${{ runner.tool_cache }}/cargo-vet/bin" >> $GITHUB_PATH
3036
- name: Ensure that the tool cache is populated with the cargo-vet binary
3137
run: cargo install --root ${{ runner.tool_cache }}/cargo-vet --version ${{ env.CARGO_VET_VERSION }} cargo-vet
38+
- name: Download Cargo.lock files
39+
if: ${{ inputs.download-lockfiles }}
40+
uses: actions/download-artifact@v4
41+
with:
42+
name: updated-lock-files
3243
- name: Invoke cargo-vet
3344
run: cargo vet --locked
3445
- name: Save PR number
3546
# PR number is saved as an artifact so it can be used to determine the PR to comment on by the vet-pr-comment workflow
3647
# vet-pr-comment workflow is triggered by the workflow_run event so it runs in the context of the base branch and not the PR branch
37-
if: ${{ failure() }} || ${{ success() }}
48+
if: ${{ github.event_name == 'pull_request' && (failure() || success()) }}
3849
run: |
3950
mkdir -p ./pr
4051
echo ${{ github.event.number }} > ./pr/NR
4152
- uses: actions/upload-artifact@v4
4253
# Need to upload the artifact in both success and failure cases so comment can be updated in either case
43-
if: ${{ failure() }} || ${{ success() }}
54+
if: ${{ github.event_name == 'pull_request' && (failure() || success()) }}
4455
with:
4556
name: pr
4657
path: pr/

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ jobs:
167167
strategy:
168168
fail-fast: false
169169
matrix:
170-
msrv: ["1.85"]
170+
msrv: ["1.88"]
171171
target: [x86_64-unknown-linux-gnu, thumbv8m.main-none-eabihf]
172172
name: ubuntu / ${{ matrix.msrv }} / ${{ matrix.target }}
173173
steps:

.github/workflows/rolling.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,19 @@ jobs:
5252
uses: ./.github/workflows/check.yml
5353
with:
5454
download-lockfiles: true
55+
56+
check-cargo-vet:
57+
name: cargo-update / check-cargo-vet
58+
needs: [update-dependencies, check-build]
59+
if: ${{ needs.update-dependencies.outputs.pr-needed == 'true' }}
60+
uses: ./.github/workflows/cargo-vet.yml
61+
with:
62+
download-lockfiles: true
5563

5664
pull-request:
5765
name: cargo-update / pull-request
5866
runs-on: ubuntu-latest
59-
needs: [check-build, update-dependencies]
67+
needs: [check-build, check-cargo-vet, update-dependencies]
6068
if: ${{ needs.update-dependencies.outputs.pr-needed == 'true' }}
6169
steps:
6270
- uses: actions/checkout@v4

Cargo.lock

Lines changed: 3 additions & 89 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ cortex-m-rt = "0.7.5"
4242
critical-section = "1.1"
4343
defmt = "0.3"
4444
document-features = "0.2.7"
45-
embassy-executor = "0.9.1"
4645
embassy-futures = "0.1.2"
4746
embassy-imxrt = { git = "https://github.com/OpenDevicePartnership/embassy-imxrt" }
4847
embassy-sync = "0.7.2"
@@ -69,7 +68,7 @@ postcard = "1.*"
6968
proc-macro2 = "1.0"
7069
quote = "1.0"
7170
rand_core = "0.6.4"
72-
rstest = {version = "0.26.1", default-features = false }
71+
rstest = { version = "0.26.1", default-features = false }
7372
serde = { version = "1.0.*", default-features = false }
7473
static_cell = "2.1.0"
7574
toml = { version = "0.8", default-features = false }

battery-service/Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ version = "0.1.0"
44
edition = "2024"
55
description = "Battery fuel gauge and charger embedded service implementation"
66
repository = "https://github.com/OpenDevicePartnership/embedded-services"
7-
rust-version = "1.85"
7+
rust-version = "1.88"
88
license = "MIT"
99

1010
[lints]
1111
workspace = true
1212

1313
[dependencies]
1414
defmt = { workspace = true, optional = true }
15-
embassy-executor.workspace = true
1615
embassy-futures.workspace = true
1716
embassy-sync.workspace = true
1817
embassy-time.workspace = true
@@ -31,7 +30,6 @@ defmt = [
3130
"embedded-services/defmt",
3231
"embassy-time/defmt",
3332
"embassy-sync/defmt",
34-
"embassy-executor/defmt",
3533
"embedded-batteries-async/defmt",
3634
"mctp-rs/defmt",
3735
]
@@ -40,5 +38,4 @@ log = [
4038
"embedded-services/log",
4139
"embassy-time/log",
4240
"embassy-sync/log",
43-
"embassy-executor/log",
4441
]

battery-service/src/acpi.rs

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -134,32 +134,35 @@ pub(crate) fn compute_bix<'a>(
134134
oem_info: [0u8; STD_BIX_OEM_SIZE],
135135
battery_swapping_capability: embedded_batteries_async::acpi::BatterySwapCapability::NonSwappable,
136136
};
137-
bix_return.model_number[..core::cmp::min(STD_BIX_MODEL_SIZE - 1, static_cache.device_name.len() - 1)]
138-
.copy_from_slice(
139-
static_cache.device_name[..core::cmp::min(STD_BIX_MODEL_SIZE - 1, static_cache.device_name.len() - 1)]
140-
.try_into()
141-
.map_err(|_| ())?,
142-
);
143-
bix_return.serial_number[..core::cmp::min(STD_BIX_SERIAL_SIZE - 1, static_cache.serial_num.len() - 1)]
144-
.copy_from_slice(
145-
static_cache.serial_num[..core::cmp::min(STD_BIX_SERIAL_SIZE - 1, static_cache.serial_num.len() - 1)]
146-
.try_into()
147-
.map_err(|_| ())?,
148-
);
149-
bix_return.battery_type[..core::cmp::min(STD_BIX_BATTERY_SIZE - 1, static_cache.device_chemistry.len() - 1)]
150-
.copy_from_slice(
151-
static_cache.device_chemistry
152-
[..core::cmp::min(STD_BIX_BATTERY_SIZE - 1, static_cache.device_chemistry.len() - 1)]
153-
.try_into()
154-
.map_err(|_| ())?,
155-
);
156-
bix_return.oem_info[..core::cmp::min(STD_BIX_OEM_SIZE - 1, static_cache.manufacturer_name.len() - 1)]
157-
.copy_from_slice(
158-
static_cache.manufacturer_name
159-
[..core::cmp::min(STD_BIX_OEM_SIZE - 1, static_cache.manufacturer_name.len() - 1)]
160-
.try_into()
161-
.map_err(|_| ())?,
162-
);
137+
138+
let model_number_len = core::cmp::min(STD_BIX_MODEL_SIZE - 1, static_cache.device_name.len() - 1);
139+
bix_return
140+
.model_number
141+
.get_mut(..model_number_len)
142+
.ok_or(())?
143+
.copy_from_slice(static_cache.device_name.get(..model_number_len).ok_or(())?);
144+
145+
let serial_number_len = core::cmp::min(STD_BIX_SERIAL_SIZE - 1, static_cache.serial_num.len() - 1);
146+
bix_return
147+
.serial_number
148+
.get_mut(..serial_number_len)
149+
.ok_or(())?
150+
.copy_from_slice(static_cache.serial_num.get(..serial_number_len).ok_or(())?);
151+
152+
let battery_type_len = core::cmp::min(STD_BIX_BATTERY_SIZE - 1, static_cache.device_chemistry.len() - 1);
153+
bix_return
154+
.battery_type
155+
.get_mut(..battery_type_len)
156+
.ok_or(())?
157+
.copy_from_slice(static_cache.device_chemistry.get(..battery_type_len).ok_or(())?);
158+
159+
let oem_info_len = core::cmp::min(STD_BIX_OEM_SIZE - 1, static_cache.manufacturer_name.len() - 1);
160+
bix_return
161+
.oem_info
162+
.get_mut(..oem_info_len)
163+
.ok_or(())?
164+
.copy_from_slice(static_cache.manufacturer_name.get(..oem_info_len).ok_or(())?);
165+
163166
Ok(bix_return)
164167
}
165168

0 commit comments

Comments
 (0)