feat: add -h, update docs
All checks were successful
/ build_debian (push) Successful in 17s

This commit is contained in:
s3lph 2024-11-30 01:29:50 +01:00
parent bba1e6edc0
commit f4b4d31609
Signed by: s3lph
GPG key ID: 0AA29A52FB33CFB5
2 changed files with 42 additions and 17 deletions

View file

@ -16,15 +16,18 @@ To not rely on a Windows VM for configuring the scanner, I sniffed the USB traff
First of all, compile the program using `make`. It depends only on `libusb-1.0`.
The configuration strings need to be provided as command line arguments. You can provide multiple:
The configuration commands can be provided either as CLI arguments or via stdin; if CLI commands are present, stdin is ignrored.
```
usage: ./honeywell-config [-v vendor] [-p product] [-o] [-r] [-d] command1 [command2 [... commandN]]
Usage: ./honeywell-config [-v vendor] [-p product] [-1] [-r] [-d] [-i infile] [-o outfile] [command1 [... commandN]]
-v vendor USB vendor ID of the barcode scanner
-p product USB product ID of the barcode scanner
-o Print response on one line, rather than one token per line
-p product USB product ID of the barcode scanner
-1 Print response on one line, rather than one token per line
-r Reset device after configuration
-d Debug mode (more verbose output)
-i infile Read input from infile instead of stdin
-o outfile Write output to outfile instead of stdout
-h Show this help
```
If no vendor ID or product ID is provided, the following set of IDs is tried:
@ -37,10 +40,31 @@ USB serial mode (`0c2e:0b0a`) is skipped because USB configuration does not seem
For the actual configuration commands, please refer to your scanner's manual. Here are some examples.
### Dump Current Config
When invoked without any command or input file, the command `?.` is run, which dumps the current config of the barcode scanner:
```shell-session
$ ./honeywell-config
BEPFQ12550.
BEPFQ2100.
...
AXXMOD0.
```
Please not that this dump can not be restored as-is - it contains some commands that are not really config options, among them the factor reset commands `DEFOVR.` and `DEFALT.`
### Retrieve Firmware Version and Build Date
```shell-session
$ ./honeywell-config 'REV?'
REV_SW13718|/tags/BE000186BAA,_TDFeb 11 2014,_WABE000186BAA,INF.
```
### Factory Reset
```
$ ./honeywell-config DEFOVR. DEFALT.
```shell-session
$ ./honeywell-config DEFOVR DEFALT
DEFOVR.
DEFALT.
```
@ -49,22 +73,22 @@ DEFALT.
USBHID:
```
$ ./honeywell-config PAP131.
```shell-session
$ ./honeywell-config PAP131
PAP131.
```
Keyboard (PC):
```
$ ./honeywell-config PAP124.
```shell-session
$ ./honeywell-config PAP124
PAP124.
```
Keyboard (Apple):
```
$ ./honeywell-config PAP125.
```shell-session
$ ./honeywell-config PAP125
PAP124.
```
@ -74,8 +98,8 @@ Please note that when switching modes, the scanner restarts on its own, so some
The following adds the string `FCKAFD ` (ASCII hex `46 43 4B 41 46 44 20`) in front of every scanned barcode:
```
$ ./honeywell-config PREBK29946434B41464420.
```shell-session
$ ./honeywell-config PREBK29946434B41464420
PREBK29946434B41464420.
```
@ -97,7 +121,7 @@ On the USB config interface, all of that goes into a single string instead.
### Query Current Beeper Settings
```
$ ./honeywell-config 'BEP?.'
$ ./honeywell-config 'BEP?'
BEPFQ12550,FQ2100,RPT1,ERR1,BEP1,BIP0,LVL0,EXZ,GRX,EXE,DFT,LED1.
```

View file

@ -380,7 +380,7 @@ int main(int argc, char **argv) {
int opt;
char *end;
long parsed;
while ((opt = getopt(argc, argv, "v:p:1rdi:o:")) != -1) {
while ((opt = getopt(argc, argv, "v:p:1rdi:o:h")) != -1) {
switch (opt) {
case 'v':
end = optarg;
@ -441,7 +441,7 @@ int main(int argc, char **argv) {
}
break;
default:
printf("usage: %s [-v vendor] [-p product] [-1] [-r] [-d] [-i infile] [-o outfile] [command1 [... commandN]]\n", argv[0]);
printf("Usage: %s [-v vendor] [-p product] [-1] [-r] [-d] [-i infile] [-o outfile] [command1 [... commandN]]\n", argv[0]);
puts(" -v vendor\tUSB vendor ID of the barcode scanner");
puts(" -p product\tUSB product ID of the barcode scanner");
puts(" -1\t\tPrint response on one line, rather than one token per line");
@ -449,6 +449,7 @@ int main(int argc, char **argv) {
puts(" -d\t\tDebug mode (more verbose output)");
puts(" -i infile\tRead input from infile instead of stdin");
puts(" -o outfile\tWrite output to outfile instead of stdout");
puts(" -h \t\tShow this help");
return 1;
}
}