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`. 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 -v vendor USB vendor ID of the barcode scanner
-p product USB product 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 -1 Print response on one line, rather than one token per line
-r Reset device after configuration -r Reset device after configuration
-d Debug mode (more verbose output) -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: 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. 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 ### Factory Reset
``` ```shell-session
$ ./honeywell-config DEFOVR. DEFALT. $ ./honeywell-config DEFOVR DEFALT
DEFOVR. DEFOVR.
DEFALT. DEFALT.
``` ```
@ -49,22 +73,22 @@ DEFALT.
USBHID: USBHID:
``` ```shell-session
$ ./honeywell-config PAP131. $ ./honeywell-config PAP131
PAP131. PAP131.
``` ```
Keyboard (PC): Keyboard (PC):
``` ```shell-session
$ ./honeywell-config PAP124. $ ./honeywell-config PAP124
PAP124. PAP124.
``` ```
Keyboard (Apple): Keyboard (Apple):
``` ```shell-session
$ ./honeywell-config PAP125. $ ./honeywell-config PAP125
PAP124. 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: The following adds the string `FCKAFD ` (ASCII hex `46 43 4B 41 46 44 20`) in front of every scanned barcode:
``` ```shell-session
$ ./honeywell-config PREBK29946434B41464420. $ ./honeywell-config PREBK29946434B41464420
PREBK29946434B41464420. PREBK29946434B41464420.
``` ```
@ -97,7 +121,7 @@ On the USB config interface, all of that goes into a single string instead.
### Query Current Beeper Settings ### Query Current Beeper Settings
``` ```
$ ./honeywell-config 'BEP?.' $ ./honeywell-config 'BEP?'
BEPFQ12550,FQ2100,RPT1,ERR1,BEP1,BIP0,LVL0,EXZ,GRX,EXE,DFT,LED1. 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; int opt;
char *end; char *end;
long parsed; 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) { switch (opt) {
case 'v': case 'v':
end = optarg; end = optarg;
@ -441,7 +441,7 @@ int main(int argc, char **argv) {
} }
break; break;
default: 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(" -v vendor\tUSB vendor ID of the barcode scanner");
puts(" -p product\tUSB product 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"); 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(" -d\t\tDebug mode (more verbose output)");
puts(" -i infile\tRead input from infile instead of stdin"); puts(" -i infile\tRead input from infile instead of stdin");
puts(" -o outfile\tWrite output to outfile instead of stdout"); puts(" -o outfile\tWrite output to outfile instead of stdout");
puts(" -h \t\tShow this help");
return 1; return 1;
} }
} }