Skip to content
Merged
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
40 changes: 40 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Code quality

# CodeQL with the "security-and-quality" suite: bugs, dead code, risky patterns.
# Results land in the Security tab and as annotations on pull requests.
on:
push:
branches: [main]
pull_request:
schedule:
- cron: "0 4 * * 1"
workflow_dispatch:

concurrency:
group: codeql-${{ github.ref }}
cancel-in-progress: true

permissions:
actions: read
contents: read
security-events: write

jobs:
analyze:
name: CodeQL (${{ matrix.language }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# build-mode none: no compilation, so the Windows-only projects are analyzed on Linux too.
language: [csharp, python, actions]
steps:
- uses: actions/checkout@v4
- uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: none
queries: security-and-quality
- uses: github/codeql-action/analyze@v4
with:
category: /language:${{ matrix.language }}
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ jobs:
dotnet publish src/AppleRemote.App -c Release -r ${{ matrix.rid }}
--self-contained false -p:PublishSingleFile=true -p:AppleRemoteDriver=false
-p:Version=${{ needs.version.outputs.version }} -o out
- run: >
dotnet publish src/AppleRemote.MacroEditor -c Release -r ${{ matrix.rid }}
--self-contained false -p:PublishSingleFile=true -p:AppleRemoteDriver=false
-p:Version=${{ needs.version.outputs.version }} -o out
- uses: actions/upload-artifact@v4
with:
name: app-${{ matrix.rid }}
Expand Down
15 changes: 15 additions & 0 deletions AppleRemote.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppleRemote.DriverInstaller", "src\AppleRemote.DriverInstaller\AppleRemote.DriverInstaller.csproj", "{EADBFBBB-C1D1-474F-8FE7-B1520E4D54ED}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppleRemote.MacroEditor", "src\AppleRemote.MacroEditor\AppleRemote.MacroEditor.csproj", "{60B125CA-8F19-47C5-B9D1-1589D6BBD616}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -85,6 +87,18 @@ Global
{EADBFBBB-C1D1-474F-8FE7-B1520E4D54ED}.Release|x64.Build.0 = Release|Any CPU
{EADBFBBB-C1D1-474F-8FE7-B1520E4D54ED}.Release|x86.ActiveCfg = Release|Any CPU
{EADBFBBB-C1D1-474F-8FE7-B1520E4D54ED}.Release|x86.Build.0 = Release|Any CPU
{60B125CA-8F19-47C5-B9D1-1589D6BBD616}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60B125CA-8F19-47C5-B9D1-1589D6BBD616}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60B125CA-8F19-47C5-B9D1-1589D6BBD616}.Debug|x64.ActiveCfg = Debug|Any CPU
{60B125CA-8F19-47C5-B9D1-1589D6BBD616}.Debug|x64.Build.0 = Debug|Any CPU
{60B125CA-8F19-47C5-B9D1-1589D6BBD616}.Debug|x86.ActiveCfg = Debug|Any CPU
{60B125CA-8F19-47C5-B9D1-1589D6BBD616}.Debug|x86.Build.0 = Debug|Any CPU
{60B125CA-8F19-47C5-B9D1-1589D6BBD616}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60B125CA-8F19-47C5-B9D1-1589D6BBD616}.Release|Any CPU.Build.0 = Release|Any CPU
{60B125CA-8F19-47C5-B9D1-1589D6BBD616}.Release|x64.ActiveCfg = Release|Any CPU
{60B125CA-8F19-47C5-B9D1-1589D6BBD616}.Release|x64.Build.0 = Release|Any CPU
{60B125CA-8F19-47C5-B9D1-1589D6BBD616}.Release|x86.ActiveCfg = Release|Any CPU
{60B125CA-8F19-47C5-B9D1-1589D6BBD616}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -93,6 +107,7 @@ Global
{6F1D3A52-0B1C-4E5E-9A55-1C2B7D0A0001} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{6F1D3A52-0B1C-4E5E-9A55-1C2B7D0A0002} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{EADBFBBB-C1D1-474F-8FE7-B1520E4D54ED} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{60B125CA-8F19-47C5-B9D1-1589D6BBD616} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {237177C1-3550-464C-8D56-41933005CEEC}
Expand Down
10 changes: 6 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ src/AppleRemote.Windows HID (SetupAPI + hid.dll), unlock, reading, SendInput,
HCI transport over WinUSB (UsbHci.cs, any adapter under the WinUSB driver)
src/AppleRemote.App WPF window (startup project) net10.0-windows10.0.19041.0
WPF-UI + MVVM: MainWindow = NavigationView menu; Remote, Settings, Debug pages
(menu footer) sharing MainViewModel; common styles in Views/Styles.xaml
(menu footer), one view-model per page (ViewModels/Page) owned by MainViewModel (settings + session); common styles in Views/Styles.xaml
src/AppleRemote.DriverInstaller installs / removes the kernel filter through its package (pnputil), requires elevation; launched by the app's button
src/AppleRemoteDriver KMDF kernel filter in Rust (windows-drivers-rs) under BTHUSB, extension INF; signed package (test certificate)
tests/AppleRemote.Tests xunit, run on any OS (sample.jsonl + golden.json)
Expand Down Expand Up @@ -104,10 +104,12 @@ Required SDK: **.NET 10**. Run the tests after any change to `Core`.
`BondStore`), connection, encryption, HID discovery, unlock, all buttons and gestures decoded by
`RemotePipeline`, encrypted reconnection after sleep. Right after a pairing, the remote drops once or twice
(reason 0x13): the loop reconnects by itself. Only re-pair on key rejection (0x05/0x06), not on 0x3E.
- **In the app**: `RemoteSession.Start` uses direct Bluetooth if `UsbHci.Open()` succeeds (first USB Bluetooth adapter
under WinUSB, detected by its `E0/01/01` class, any VID/PID), otherwise Windows' HID (with the filter). Keys in `%AppData%\AppleRemote\bonds.json`; without keys, scan for a
- **In the app**: `RemoteSession.Start` uses direct Bluetooth if `UsbHci.Open(AdapterId)` succeeds (adapter chosen in Settings
if under WinUSB, else the first one under WinUSB, detected by its `E0/01/01` class, any VID/PID), otherwise Windows' HID (with the filter). Keys in `%AppData%\AppleRemote\bonds.json`; without keys, scan for a
remote in pairing mode (service 0x1812 + Apple data 0x004C). "Pair" forgets the keys and restarts.
Only one adapter handled (the first found; `WinUsbDriver.Find` for driver install/restore). Firmware is not loaded: the UB500 (Realtek) would additionally need its firmware loaded.
Several adapters: `WinUsbDriver.List` (PnP, compatible ID `USB\Class_E0&SubClass_01&Prot_01`), the Settings ComboBox picks one
(PnP instance ID in `settings.json` `Adapter`), WinUSB install/restore target it (`--driver install|restore <instanceId>`).
WinUSB is installed by VID/PID: two identical dongles switch together. Bonds are tied to the adapter: re-pair after switching. Firmware is not loaded: the UB500 (Realtek) would additionally need its firmware loaded.
`FakeRemote` (tests) reproduces the real one's GATT database (handles `0x1D` F0, `0x20` F1, `0x23`/`0x24` FC).
- Reports received over GATT: the ID (`0xFC`) is not in the notification; it is put back at the front to keep the `hid.dll` format.
- Application windows running as administrator ignore `SendInput` from a non-elevated program (UIPI).
Expand Down
7 changes: 4 additions & 3 deletions installer/AppleRemote.iss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
; SPDX-License-Identifier: AGPL-3.0-or-later
; Inno Setup script. Packages a release layout (the content of an AppleRemote-<version>-<rid>.zip):
; iscc /DAppVersion=1.0.0 /DSourceDir=C:\path\to\unzipped /DArch=x64 installer\AppleRemote.iss
; iscc /DAppVersion=1.1.0 /DSourceDir=C:\path\to\unzipped /DArch=x64 installer\AppleRemote.iss
; Arch: x64 (default) or arm64. The kernel filter ("driver" subfolder) only exists for x64.

#ifndef AppVersion
#define AppVersion "1.0.0"
#define AppVersion "1.1.0"
#endif
#ifndef SourceDir
#define SourceDir "..\Publish"
Expand All @@ -19,7 +19,7 @@ AppName=Apple Remote
AppVersion={#AppVersion}
AppPublisher=AnthoDingo
DefaultDirName={autopf}\AppleRemote
DefaultGroupName=Apple Remote
DefaultGroupName=AppleRemote
UninstallDisplayIcon={app}\AppleRemote.exe
OutputDir=..\Output
OutputBaseFilename=AppleRemote-{#AppVersion}-win-{#Arch}-setup
Expand All @@ -46,6 +46,7 @@ Source: "..\keymap.example.json"; DestDir: "{app}"; Flags: ignoreversion

[Icons]
Name: "{group}\Apple Remote"; Filename: "{app}\AppleRemote.exe"
Name: "{group}\Macro Editor"; Filename: "{app}\AppleRemote.MacroEditor.exe"
Name: "{autodesktop}\Apple Remote"; Filename: "{app}\AppleRemote.exe"; Tasks: desktopicon

[Run]
Expand Down
2 changes: 1 addition & 1 deletion src/AppleRemote.App/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected override void OnStartup(StartupEventArgs e)
{
Loc.SetLanguage(Settings.Load().Language); // before any text, including the elevated instance's
// Elevated instance launched by DriverCommand: no window, just the operation.
if (e.Args is ["--driver", var verb]) Environment.Exit(DriverCommand.Run(verb));
if (e.Args is ["--driver", var verb, var adapter]) Environment.Exit(DriverCommand.Run(verb, adapter));

_instance = new Mutex(true, @"Local\AppleRemote.Instance", out bool first);
_showRequest = new EventWaitHandle(false, EventResetMode.AutoReset, @"Local\AppleRemote.Show");
Expand Down
8 changes: 7 additions & 1 deletion src/AppleRemote.App/AppleRemote.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<UseWPF>true</UseWPF>
<RootNamespace>AppleRemote.App</RootNamespace>
<AssemblyName>AppleRemote</AssemblyName>
<Version>1.0.0</Version>
<Version>1.1.0</Version>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>app.ico</ApplicationIcon>
<!-- Debug page and its menu entry: off by default, enabled only by a Debug build. -->
Expand All @@ -38,10 +38,16 @@

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2903.40" />
<PackageReference Include="WPF-UI" Version="4.3.0" />
<PackageReference Include="WPF-UI.Tray" Version="4.3.0" />
</ItemGroup>

<ItemGroup>
<!-- Éditeur de macro : Blockly 11.2.2 (Apache-2.0) et sa page, servis au WebView2 depuis le dossier de l'exe. -->
<Content Include="Blockly\**" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<ItemGroup>
<Folder Include="Assets\" />
</ItemGroup>
Expand Down
Loading
Loading