Skip to content

Commit 494b3d1

Browse files
authored
Merge pull request #38 from OpenTabletDriver/main
Bump v4.x branch on release publish
2 parents 64474ac + 6d1ff71 commit 494b3d1

11 files changed

Lines changed: 190 additions & 85 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tabletdrivercleanup"
3-
version = "4.0.3"
3+
version = "4.1.1"
44
edition = "2021"
55

66
[profile.release]

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,5 @@ For those who want to build the project from source:
6262
- Run `build.ps1` in the root directory
6363

6464
The binaries will be in `build`.
65+
66+
## [Dev Docs](./dev_docs.md)

config/driver_package_identifiers.json

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@
5454
"display_name": "Huion ?Tablet",
5555
"display_version": "^15"
5656
},
57+
{
58+
"friendly_name": "Huion v20.x",
59+
"uninstall_method": "Deferred",
60+
"display_name": "Huion ?Tablet",
61+
"display_version": "^20"
62+
},
5763
{
5864
"friendly_name": "Kenting Tablet v14.x",
5965
"uninstall_method": "Normal",
@@ -114,6 +120,12 @@
114120
"display_name": "VKTabletDriver",
115121
"display_version": "^2"
116122
},
123+
{
124+
"friendly_name": "Veikk Tablet Driver v3.x",
125+
"uninstall_method": "Deferred",
126+
"display_name": "Veikk ?Tablet",
127+
"display_version": "^3"
128+
},
117129
{
118130
"friendly_name": "Wacom Tablet v6.3.x",
119131
"uninstall_method": "Normal",
@@ -155,17 +167,28 @@
155167
"display_name": "Veikk \\(WinUsb\\) USBVeikk"
156168
},
157169
{
158-
"friendly_name": "Xencelabs v1.1",
170+
"friendly_name": "Windows Driver Package - Veikk (vkmoufilter) Mouse",
171+
"uninstall_method": "RegistryOnly",
172+
"display_name": "Veikk \\(vkmoufilter\\) Mouse"
173+
},
174+
{
175+
"friendly_name": "Xencelabs v1.1.x",
159176
"uninstall_method": "Deferred",
160177
"display_name": "Xencelabs",
161178
"display_version": "^1.1"
162179
},
163180
{
164-
"friendly_name": "Xencelabs v1.2",
181+
"friendly_name": "Xencelabs v1.2.x",
165182
"uninstall_method": "Deferred",
166183
"display_name": "Xencelabs",
167184
"display_version": "^1.2"
168185
},
186+
{
187+
"friendly_name": "Xencelabs v1.3.x",
188+
"uninstall_method": "Deferred",
189+
"display_name": "Xencelabs",
190+
"display_version": "^1.3"
191+
},
169192
{
170193
"friendly_name": "XENX Driver v1.x",
171194
"uninstall_method": "Deferred",
@@ -178,5 +201,12 @@
178201
"display_name": "Pentablet",
179202
"display_version": "^3",
180203
"publisher": "XP[-| ]?Pen"
204+
},
205+
{
206+
"friendly_name": "XP-Pen Driver v4.x",
207+
"uninstall_method": "Deferred",
208+
"display_name": "XPPenTablet",
209+
"display_version": "^4",
210+
"publisher": "XP[-| ]?Pen"
181211
}
182212
]

dev_docs.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## Config Files
2+
3+
All config attributes are optional. Any omitted attributes will be ignored when matching.
4+
5+
All regex matches are case insensitive. Use `\\` for backslashes, regex `\d` for example should be entered as `\\d`.
6+
7+
### `device_identifiers.json`
8+
9+
- `friendly_name`: Displayed to user, not matched against
10+
- `device_desc`: Regex match (`Device Description` in pnputil_devices dump)
11+
- `manufacturer`: Regex match (`Manufacturer Name` in pnputil_devices dump)
12+
- `hardware_id`: Regex match (`Instance ID` in pnputil_devices dump)
13+
- `class_uuid`: Exact string match (`Class GUID` in pnputil_devices dump)
14+
- `inf_provider`: Regex match (`Provider Name` in pnputil_devices dump)
15+
16+
### `driver_identifiers.json`
17+
18+
- `friendly_name`: Displayed to user, not matched against
19+
- `original_name`: Regex match (`Original Name` in pnputil_drivers dump)
20+
- `provider`: Regex match (`Provider Name` in pnputil_drivers dump)
21+
- `class`: Exact string match (`Class GUID` in pnputil_drivers dump)
22+
23+
### `driver_package_identifiers.json`
24+
25+
- `friendly_name`: Displayed to user, not matched against
26+
- `display_name`: Regex match
27+
- `display_version`: Regex match
28+
- `publisher`: Regex match
29+
- `uninstall_method`: `Normal|Deferred|RegistryOnly`
30+
31+
## Github Release Instructions
32+
33+
- Set the new version in `Cargo.toml` and let it propagate to `Cargo.lock`.
34+
- PR and merge the version bump change.
35+
- Push a tag with the new version and a draft release will be created.
36+
- Review the draft and set it to latest if it looks good.
37+
- A PR will be automatically created to pull the latest changes from `main` into the config branch.

src/cleanup_modules/device_cleanup.rs

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -148,36 +148,47 @@ struct DeviceDumper {}
148148
#[async_trait]
149149
impl Dumper for DeviceDumper {
150150
async fn dump(&self, state: &State) -> Result<(), ModuleError> {
151-
let inf_regex = Regex::new(r"^oem[0-9]+\.inf$").unwrap();
152-
let devices: Vec<Device> = enumerate_devices()
153-
.into_module_report(DEVICE_MODULE_NAME)?
154-
.into_iter()
155-
.filter(|d| inf_regex.is_match(d.inf_name().unwrap_or("")))
156-
.filter(is_of_interest)
157-
.collect();
158-
159-
let file_path =
160-
get_path_to_dump(state, "devices.json").into_module_report(DEVICE_MODULE_NAME)?;
161-
let dump_file = create_dump_file(&file_path).into_module_report(DEVICE_MODULE_NAME)?;
162-
let file_name = file_path.as_path().to_str().unwrap();
163-
164-
if devices.is_empty() {
165-
println!("No devices to dump");
166-
return Ok(());
167-
}
151+
dump_filtered(state, "devices.json", is_of_interest).await
152+
}
168153

169-
serde_json::to_writer_pretty(dump_file, &devices)
170-
.into_report()
171-
.attach_printable_lazy(|| format!("failed to dump devices into '{}'", file_name))
172-
.into_module_report(DEVICE_MODULE_NAME)?;
154+
async fn dumpall(&self, state: &State) -> Result<(), ModuleError> {
155+
dump_filtered(state, "devices-all.json", |_| true).await
156+
}
157+
}
173158

174-
match devices.len() {
175-
1 => println!("Dumped 1 device to {}", file_name),
176-
n => println!("Dumped {} devices to {}", n, file_name),
177-
}
159+
async fn dump_filtered<F: Fn(&Device) -> bool>(
160+
state: &State,
161+
output_file: &str,
162+
filter_fn: F,
163+
) -> Result<(), ModuleError> {
164+
let inf_regex = Regex::new(r"^oem[0-9]+\.inf$").unwrap();
165+
let devices: Vec<Device> = enumerate_devices()
166+
.into_module_report(DEVICE_MODULE_NAME)?
167+
.into_iter()
168+
.filter(|d| inf_regex.is_match(d.inf_name().unwrap_or("")))
169+
.filter(filter_fn)
170+
.collect();
171+
172+
let file_path = get_path_to_dump(state, output_file).into_module_report(DEVICE_MODULE_NAME)?;
173+
let dump_file = create_dump_file(&file_path).into_module_report(DEVICE_MODULE_NAME)?;
174+
let file_name = file_path.as_path().to_str().unwrap();
175+
176+
if devices.is_empty() {
177+
println!("No devices to dump");
178+
return Ok(());
179+
}
178180

179-
Ok(())
181+
serde_json::to_writer_pretty(dump_file, &devices)
182+
.into_report()
183+
.attach_printable_lazy(|| format!("failed to dump devices into '{}'", file_name))
184+
.into_module_report(DEVICE_MODULE_NAME)?;
185+
186+
match devices.len() {
187+
1 => println!("Dumped 1 device to {}", file_name),
188+
n => println!("Dumped {} devices to {}", n, file_name),
180189
}
190+
191+
Ok(())
181192
}
182193

183194
#[derive(Deserialize, Debug)]

src/cleanup_modules/driver_cleanup.rs

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -124,34 +124,45 @@ struct DriverDumper {}
124124
#[async_trait]
125125
impl Dumper for DriverDumper {
126126
async fn dump(&self, state: &State) -> Result<(), ModuleError> {
127-
let drivers: Vec<Driver> = enumerate_drivers()
128-
.into_module_report(DRIVER_MODULE_NAME)?
129-
.into_iter()
130-
.filter(is_of_interest)
131-
.collect();
132-
133-
let file_path =
134-
get_path_to_dump(state, "drivers.json").into_module_report(DRIVER_MODULE_NAME)?;
135-
let dump_file = create_dump_file(&file_path).into_module_report(DRIVER_MODULE_NAME)?;
136-
let file_name = file_path.as_path().to_str().unwrap();
137-
138-
if drivers.is_empty() {
139-
println!("No drivers to dump");
140-
return Ok(());
141-
}
127+
dump_filtered(state, "drivers.json", is_of_interest).await
128+
}
142129

143-
serde_json::to_writer_pretty(dump_file, &drivers)
144-
.into_report()
145-
.attach_printable_lazy(|| format!("failed to dump drivers into '{}'", file_name))
146-
.into_module_report(DRIVER_MODULE_NAME)?;
130+
async fn dumpall(&self, state: &State) -> Result<(), ModuleError> {
131+
dump_filtered(state, "drivers-all.json", |_| true).await
132+
}
133+
}
147134

148-
match drivers.len() {
149-
1 => println!("Dumped 1 driver into '{}'", file_name),
150-
n => println!("Dumped {} drivers into '{}'", n, file_name),
151-
}
135+
async fn dump_filtered<F: Fn(&Driver) -> bool>(
136+
state: &State,
137+
output_file: &str,
138+
filter_fn: F,
139+
) -> Result<(), ModuleError> {
140+
let drivers: Vec<Driver> = enumerate_drivers()
141+
.into_module_report(DRIVER_MODULE_NAME)?
142+
.into_iter()
143+
.filter(filter_fn)
144+
.collect();
145+
146+
let file_path = get_path_to_dump(state, output_file).into_module_report(DRIVER_MODULE_NAME)?;
147+
let dump_file = create_dump_file(&file_path).into_module_report(DRIVER_MODULE_NAME)?;
148+
let file_name = file_path.as_path().to_str().unwrap();
149+
150+
if drivers.is_empty() {
151+
println!("No drivers to dump");
152+
return Ok(());
153+
}
152154

153-
Ok(())
155+
serde_json::to_writer_pretty(dump_file, &drivers)
156+
.into_report()
157+
.attach_printable_lazy(|| format!("failed to dump drivers into '{}'", file_name))
158+
.into_module_report(DRIVER_MODULE_NAME)?;
159+
160+
match drivers.len() {
161+
1 => println!("Dumped 1 driver into '{}'", file_name),
162+
n => println!("Dumped {} drivers into '{}'", n, file_name),
154163
}
164+
165+
Ok(())
155166
}
156167

157168
#[derive(Deserialize, Debug)]

src/cleanup_modules/driver_package_cleanup.rs

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -150,36 +150,45 @@ struct DriverPackageDumper {}
150150
#[async_trait]
151151
impl Dumper for DriverPackageDumper {
152152
async fn dump(&self, state: &State) -> Result<(), ModuleError> {
153-
let driver_packages: Vec<DriverPackage> = enumerate_driver_packages()
154-
.into_module_report(MODULE_NAME)?
155-
.into_iter()
156-
.filter(is_of_interest)
157-
.collect();
158-
159-
let file_path =
160-
get_path_to_dump(state, "driver-packages.json").into_module_report(MODULE_NAME)?;
161-
let dump_file = create_dump_file(&file_path).into_module_report(MODULE_NAME)?;
162-
let file_name = file_path.as_path().to_str().unwrap();
153+
dump_filtered(state, "driver-packages.json", is_of_interest).await
154+
}
163155

164-
if driver_packages.is_empty() {
165-
println!("No driver packages to dump");
166-
return Ok(());
167-
}
156+
async fn dumpall(&self, state: &State) -> Result<(), ModuleError> {
157+
dump_filtered(state, "driver-packages-all.json", |_| true).await
158+
}
159+
}
168160

169-
serde_json::to_writer_pretty(dump_file, &driver_packages)
170-
.into_report()
171-
.attach_printable_lazy(|| {
172-
format!("failed to dump driver packages into '{}'", file_name)
173-
})
174-
.into_module_report(MODULE_NAME)?;
161+
async fn dump_filtered<F: Fn(&DriverPackage) -> bool>(
162+
state: &State,
163+
output_file: &str,
164+
filter_fn: F,
165+
) -> Result<(), ModuleError> {
166+
let driver_packages: Vec<DriverPackage> = enumerate_driver_packages()
167+
.into_module_report(MODULE_NAME)?
168+
.into_iter()
169+
.filter(filter_fn)
170+
.collect();
171+
172+
let file_path = get_path_to_dump(state, output_file).into_module_report(MODULE_NAME)?;
173+
let dump_file = create_dump_file(&file_path).into_module_report(MODULE_NAME)?;
174+
let file_name = file_path.as_path().to_str().unwrap();
175+
176+
if driver_packages.is_empty() {
177+
println!("No driver packages to dump");
178+
return Ok(());
179+
}
175180

176-
match driver_packages.len() {
177-
1 => println!("Dumped 1 driver package into '{}'", file_name),
178-
n => println!("Dumped {} driver packages into '{}'", n, file_name),
179-
}
181+
serde_json::to_writer_pretty(dump_file, &driver_packages)
182+
.into_report()
183+
.attach_printable_lazy(|| format!("failed to dump driver packages into '{}'", file_name))
184+
.into_module_report(MODULE_NAME)?;
180185

181-
Ok(())
186+
match driver_packages.len() {
187+
1 => println!("Dumped 1 driver package into '{}'", file_name),
188+
n => println!("Dumped {} driver packages into '{}'", n, file_name),
182189
}
190+
191+
Ok(())
183192
}
184193

185194
#[derive(Deserialize, Debug)]

src/cleanup_modules/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ pub struct ModuleRunInfo {
178178
#[async_trait]
179179
pub trait Dumper {
180180
async fn dump(&self, state: &State) -> Result<(), ModuleError>;
181+
async fn dumpall(&self, state: &State) -> Result<(), ModuleError>;
181182
}
182183

183184
fn get_path_to_dump(state: &State, filename: &str) -> Result<PathBuf, std::io::Error> {

src/lib.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,13 @@ pub async fn dump(config: Config) {
181181
None => continue,
182182
};
183183

184-
let result = dumper.dump(&state).await;
185-
if let Err(err) = result {
186-
eprintln!("{:?}", err);
187-
eprintln!()
188-
}
184+
let results = [dumper.dump(&state).await, dumper.dumpall(&state).await];
185+
results.iter().for_each(|result| {
186+
if let Err(err) = result {
187+
eprintln!("{:?}", err);
188+
eprintln!()
189+
}
190+
});
189191
}
190192
}
191193

0 commit comments

Comments
 (0)