Skip to content

Commit 81c7e62

Browse files
authored
Merge pull request #28 from OpenTabletDriver/main
Bump v4.x branch on release publish
2 parents 4b82b08 + 0584d8e commit 81c7e62

9 files changed

Lines changed: 88 additions & 12 deletions

File tree

.github/workflows/build_test.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,20 @@ jobs:
2323
run: |
2424
powershell ./build.ps1
2525
26-
- name: Run tests
27-
run: cargo test --verbose
28-
2926
- uses: actions/upload-artifact@v6
3027
with:
3128
name: tabletdrivercleanup
3229
path: ./build
3330
if-no-files-found: error
31+
32+
test-windows:
33+
runs-on: windows-latest
34+
steps:
35+
- uses: actions/checkout@v6
36+
- name: Setup dependencies
37+
run: |
38+
rustup update stable
39+
rustup default stable
40+
41+
- name: Run tests
42+
run: cargo test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
build/
2+
dist/
23

34
# Generated by Cargo
45
# will have compiled files and executables

build.ps1

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
cargo build --release
22
if (Test-Path ./build) {
3-
Remove-Item -Path ./build -Recurse
3+
Remove-Item -Path ./build/* -Recurse
4+
} else {
5+
New-Item -Path ./build -ItemType directory > $null
6+
}
7+
if (Test-Path ./dist) {
8+
Remove-Item -Path ./dist/* -Recurse
9+
} else {
10+
New-Item -Path ./dist -ItemType directory > $null
411
}
5-
New-Item -Path ./build -ItemType directory > $null
6-
New-Item -Path ./dist -ItemType directory > $null
712
Copy-Item -Path ./target/release/tabletdrivercleanup.exe -Destination ./build
813
Copy-Item -Path ./eng/dump.bat -Destination ./build
914
Copy-Item -Path ./eng/dry_run.bat -Destination ./build

config/device_identifiers.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,10 @@
2222
"manufacturer": "GSPY",
2323
"hardware_id": "VID_(5543|28BD|256C|0A12|172F|0458|08CA|0483|0B57|2FEB|0543|056A|0531|2D80)",
2424
"class_uuid": "6264e7e6-b95c-4033-908f-86e7ab9e2555"
25+
},
26+
{
27+
"friendly_name": "LibUsb/Libwdi",
28+
"hardware_id": "VID_(5543|28BD|256C|0A12|172F|0458|08CA|0483|0B57|2FEB|0543|056A|0531|2D80)",
29+
"inf_provider": "(libusb|libwdi)"
2530
}
2631
]

config/driver_identifiers.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
"provider": "(libusbK|libusb-win32)"
3434
},
3535
{
36-
"friendly_name": "Intuos LibUsbK Driver",
37-
"original_name": "intuos.*\\.inf",
38-
"provider": "(libusbK|libusb-win32)"
36+
"friendly_name": "Wacom LibUsb/Libwdi Driver",
37+
"original_name": "(intuos|(c|p)t(l|h|k)-).*\\.inf",
38+
"provider": "(libusb|libusb-win32)"
3939
},
4040
{
4141
"friendly_name": "Hanvon Ugee Mouse Filter",

eng/dump.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ tabletdrivercleanup.exe --dump
1111
pnputil /enum-drivers > .\dumps\pnputil_drivers.txt
1212
pnputil /enum-devices /connected /drivers > .\dumps\pnputil_devices.txt
1313

14-
md .\dumps\DriverStore
14+
mkdir ".\dumps\DriverStore" 2>nul
1515

1616
for /D %%G in ("C:\Windows\System32\DriverStore\FileRepository\*") DO (
17-
md .\dumps\DriverStore\%%~nxG
17+
mkdir ".\dumps\DriverStore\%%~nxG" 2>nul
1818
for /F %%H in ("%%~G\*.inf") DO (
19-
xcopy /Q /Y "%%H" .\dumps\DriverStore\%%~nxG > nul
19+
xcopy /Q /Y "%%~H" ".\dumps\DriverStore\%%~nxG" >nul
2020
<nul set /p "=Dumped '%%~nxH' !CR!"
2121
)
2222
)

src/cleanup_modules/device_cleanup.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,14 @@ pub struct DeviceToUninstall {
188188
manufacturer: Option<String>,
189189
hardware_id: Option<String>,
190190
class_uuid: Option<Uuid>,
191+
inf_provider: Option<String>,
191192
}
192193

193194
impl ToUninstall<Device> for DeviceToUninstall {
194195
fn matches(&self, other: &Device) -> bool {
195196
regex_cache::cached_match(other.description(), self.device_desc.as_deref())
196197
&& regex_cache::cached_match(other.manufacturer(), self.manufacturer.as_deref())
198+
&& regex_cache::cached_match(other.inf_provider(), self.inf_provider.as_deref())
197199
&& match self.class_uuid {
198200
Some(uuid) => *other.class_guid() == uuid,
199201
None => true,
@@ -224,3 +226,22 @@ fn is_of_interest(device: &Device) -> bool {
224226

225227
candidate_iter(strings)
226228
}
229+
230+
#[tokio::test]
231+
async fn test_init() {
232+
let mut module = DeviceCleanupModule::new();
233+
let state = State {
234+
dry_run: true,
235+
interactive: false,
236+
use_cache: true,
237+
allow_updates: false,
238+
current_path: Default::default(),
239+
};
240+
module.initialize(&state).await.unwrap();
241+
module.get_objects_to_uninstall().iter().for_each(|d| {
242+
regex_cache::cached_match(Some(""), d.device_desc.as_deref());
243+
regex_cache::cached_match(Some(""), d.manufacturer.as_deref());
244+
regex_cache::cached_match(Some(""), d.hardware_id.as_deref());
245+
regex_cache::cached_match(Some(""), d.inf_provider.as_deref());
246+
});
247+
}

src/cleanup_modules/driver_cleanup.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,20 @@ fn is_of_interest(driver: &Driver) -> bool {
186186
let strings = [driver.inf_original_name(), driver.provider()];
187187
candidate_iter(strings.into_iter().flatten())
188188
}
189+
190+
#[tokio::test]
191+
async fn test_init() {
192+
let mut module = DriverCleanupModule::new();
193+
let state = State {
194+
dry_run: true,
195+
interactive: false,
196+
use_cache: true,
197+
allow_updates: false,
198+
current_path: Default::default(),
199+
};
200+
module.initialize(&state).await.unwrap();
201+
module.get_objects_to_uninstall().iter().for_each(|d| {
202+
regex_cache::cached_match(Some(""), d.original_name.as_deref());
203+
regex_cache::cached_match(Some(""), d.provider.as_deref());
204+
});
205+
}

src/cleanup_modules/driver_package_cleanup.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,3 +412,21 @@ fn to_command(command: &str) -> std::process::Command {
412412

413413
command
414414
}
415+
416+
#[tokio::test]
417+
async fn test_init() {
418+
let mut module = DriverPackageCleanupModule::new();
419+
let state = State {
420+
dry_run: true,
421+
interactive: false,
422+
use_cache: true,
423+
allow_updates: false,
424+
current_path: Default::default(),
425+
};
426+
module.initialize(&state).await.unwrap();
427+
module.get_objects_to_uninstall().iter().for_each(|d| {
428+
regex_cache::cached_match(Some(""), d.display_name.as_deref());
429+
regex_cache::cached_match(Some(""), d.display_version.as_deref());
430+
regex_cache::cached_match(Some(""), d.publisher.as_deref());
431+
});
432+
}

0 commit comments

Comments
 (0)