OpenBSD CVS

CVS log for src/usr.bin/usbhidaction/usbhidaction.c


[BACK] Up to [local] / src / usr.bin / usbhidaction

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.27 / (download) - annotate - [select for diffs], Wed Mar 8 04:43:12 2023 UTC (14 months, 1 week ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, HEAD
Changes since 1.26: +1 -2 lines
Diff to previous 1.26 (colored)

Delete obsolete /* ARGSUSED */ lint comments.

ok miod@ millert@

Revision 1.26 / (download) - annotate - [select for diffs], Sun Dec 4 23:50:50 2022 UTC (17 months, 2 weeks ago) by cheloha
Branch: MAIN
Changes since 1.25: +1 -2 lines
Diff to previous 1.25 (colored)

userspace: remove vestigial '?' cases from top-level getopt(3) loops

getopt(3) returns '?' when it encounters a flag not present in the in
the optstring or if a flag is missing its option argument.  We can
handle this case with the "default" failure case with no loss of
legibility.  Hence, remove all the redundant "case '?':" lines.

Prompted by dlg@.  With help from dlg@ and millert@.

Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2

ok naddy@ millert@ dlg@

Revision 1.25 / (download) - annotate - [select for diffs], Tue Aug 2 09:07:34 2022 UTC (21 months, 2 weeks ago) by mestre
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.24: +3 -1 lines
Diff to previous 1.24 (colored)

shamelessly missed to unveil(_PATH_BSHELL, "x") which is required to run the
commands inside usbhidaction(1)'s `conf' file.

reported and fix tested by Hector Velasco < tech ! ogroth . com >

Revision 1.24 / (download) - annotate - [select for diffs], Wed Dec 15 11:23:09 2021 UTC (2 years, 5 months ago) by mestre
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.23: +6 -1 lines
Diff to previous 1.23 (colored)

restrict filesystem access with unveil(2).

this one opens the default table file "/usr/share/misc/usb_hid_usages" through
hid_start(3) from libusbhid, then `dev' (will be the fd used on the ioctls)
and finally `conf' which is the file with the actions to be monitored. `conf'
needs to be unveil(2)ed with read perms since usbhidaction(1) can run as daemon
and this file will be re-read if a SIGHUP is catched.

looks good deraadt@

Revision 1.23 / (download) - annotate - [select for diffs], Fri Jun 28 13:35:05 2019 UTC (4 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.22: +5 -5 lines
Diff to previous 1.22 (colored)

When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.

Revision 1.22 / (download) - annotate - [select for diffs], Thu Mar 17 19:40:43 2016 UTC (8 years, 2 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

Last parameter to execl[e]() functions *must* be cast to a pointer.
Just NULL is not good practise as NULL is theoretically allowed to
be an integer rather than a pointer.

Use (char *)NULL consistently instead of scattering a few (char *)0
and (void *)NULL into the mix.

Prompted by and probably ok deraadt@ millert@ kettenis@

Definitely ok mestre@ ratchov@

Revision 1.21 / (download) - annotate - [select for diffs], Mon Oct 26 10:08:14 2015 UTC (8 years, 6 months ago) by jung
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.20: +1 -2 lines
Diff to previous 1.20 (colored)

remove util.h include and -lutil after pidfile removal

ok deraadt

Revision 1.20 / (download) - annotate - [select for diffs], Mon Oct 26 09:57:55 2015 UTC (8 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.19: +1 -2 lines
Diff to previous 1.19 (colored)

stop using pidfile()
ok benno jung jca

Revision 1.19 / (download) - annotate - [select for diffs], Sun Jan 18 17:18:08 2015 UTC (9 years, 4 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.18: +1 -3 lines
Diff to previous 1.18 (colored)

This size check was obviously commented out because of the incorrect
size computed for reports with reportID.

Tested by Benjamin Baier.

Revision 1.18 / (download) - annotate - [select for diffs], Fri Aug 15 03:51:40 2014 UTC (9 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.17: +2 -6 lines
Diff to previous 1.17 (colored)

Use O_CLOEXEC wherever we open a file and then call fcntl(F_SETFD, FD_CLOEXEC)
on it, simplifying error checking, reducing system calls, and improving
thread-safety for libraries.

ok miod@

Revision 1.17 / (download) - annotate - [select for diffs], Wed Nov 27 00:13:23 2013 UTC (10 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.16: +3 -3 lines
Diff to previous 1.16 (colored)

unsigned char for ctype
ok okan

Revision 1.16 / (download) - annotate - [select for diffs], Fri Mar 23 10:04:59 2012 UTC (12 years, 1 month ago) by robert
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.15: +4 -1 lines
Diff to previous 1.15 (colored)

Ignore SIGCHLD because we don't really care what happened to the forked
processes and we don't want to wait for them to finish either.
This makes the walking dead go away.

ok espie@, mikeb@

Revision 1.15 / (download) - annotate - [select for diffs], Mon Mar 7 14:59:06 2011 UTC (13 years, 2 months ago) by jasper
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.14: +13 -6 lines
Diff to previous 1.14 (colored)

- use fork(2)/exec(3) instead of system(3) to execute the specified action,
as the launched command used to be terminated when usbhidaction terminates.
using fork here prevents that.

from vadim zhukov
ok otto@

Revision 1.14 / (download) - annotate - [select for diffs], Tue Jun 29 17:16:35 2010 UTC (13 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.13: +3 -3 lines
Diff to previous 1.13 (colored)

please attempt to match the style of the code

Revision 1.13 / (download) - annotate - [select for diffs], Tue Jun 29 17:15:23 2010 UTC (13 years, 10 months ago) by ckuethe
Branch: MAIN
Changes since 1.12: +7 -1 lines
Diff to previous 1.12 (colored)

avoid a null pointer deref. ok jsg

Revision 1.12 / (download) - annotate - [select for diffs], Wed Oct 21 15:48:27 2009 UTC (14 years, 7 months ago) by sobrado
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.11: +3 -3 lines
Diff to previous 1.11 (colored)

"usage:" is lowercase; spacing.

Revision 1.11 / (download) - annotate - [select for diffs], Wed Oct 14 20:36:56 2009 UTC (14 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.10: +12 -3 lines
Diff to previous 1.10 (colored)

Call err() instead of crashing if hid_start_parse() fails.  Don't
leak FILEs or memory when parsing the conf fails.  Don't segv on
the first action when told to ignore unknown lines and there are
lines to ignore.

ok deraadt@ miod@

Revision 1.10 / (download) - annotate - [select for diffs], Thu Jun 26 05:42:21 2008 UTC (15 years, 10 months ago) by ray
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.9: +1 -8 lines
Diff to previous 1.9 (colored)

First pass at removing clauses 3 and 4 from NetBSD licenses.

Not sure what's more surprising: how long it took for NetBSD to
catch up to the rest of the BSDs (including UCB), or the amount of
code that NetBSD has claimed for itself without attributing to the
actual authors.

OK deraadt@

Revision 1.9 / (download) - annotate - [select for diffs], Fri Feb 23 17:37:28 2007 UTC (17 years, 2 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.8: +3 -2 lines
Diff to previous 1.8 (colored)

signal handler flag must be volatile sig_atomic_t

Revision 1.8 / (download) - annotate - [select for diffs], Sun Jul 9 23:02:21 2006 UTC (17 years, 10 months ago) by mk
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.7: +5 -2 lines
Diff to previous 1.7 (colored)

Two fixes:

	o Prevent a config reload from always happening after the first
	round of command execution.
	o Make sure config reload works when daemonised by requiring an
	absolute path to the config file.

From NetBSD.

Ok brad.

Revision 1.7 / (download) - annotate - [select for diffs], Sun Apr 23 08:51:24 2006 UTC (18 years, 1 month ago) by fgsch
Branch: MAIN
Changes since 1.6: +6 -1 lines
Diff to previous 1.6 (colored)

Avoid passing the device file descriptor to executed commands; deraadt@ ok

Revision 1.6 / (download) - annotate - [select for diffs], Wed Oct 27 18:16:57 2004 UTC (19 years, 6 months ago) by jaredy
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.5: +6 -6 lines
Diff to previous 1.5 (colored)

remove newlines in errx, syslog.  ok henning, hshoexer, millert

Revision 1.5 / (download) - annotate - [select for diffs], Tue Sep 14 22:59:26 2004 UTC (19 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.4: +3 -2 lines
Diff to previous 1.4 (colored)

ARGSUSED before signal handler with unused signo

Revision 1.4 / (download) - annotate - [select for diffs], Fri Jun 4 00:47:32 2004 UTC (19 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.3: +19 -19 lines
Diff to previous 1.3 (colored)

knf + new interface: hid_start() is non-exit non-stderr spewing version of hid_init(); ok matthieu millert

Revision 1.3 / (download) - annotate - [select for diffs], Sat Apr 3 21:01:25 2004 UTC (20 years, 1 month ago) by jmc
Branch: MAIN
Changes since 1.2: +3 -3 lines
Diff to previous 1.2 (colored)

- correct SYNOPSIS
- sync usage()
- some small tweaks

Revision 1.2 / (download) - annotate - [select for diffs], Tue Jun 11 06:16:36 2002 UTC (21 years, 11 months ago) by jsyn
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5, OPENBSD_3_4_BASE, OPENBSD_3_4, OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.1: +3 -3 lines
Diff to previous 1.1 (colored)

kill err(3) newlines; ok miod@, deraadt@

Revision 1.1 / (download) - annotate - [select for diffs], Fri May 10 00:09:17 2002 UTC (22 years ago) by nate
Branch: MAIN

Update usb userland stuff to reflect hid changes in the kernel.
This adds the new program usbhidaction which can be used to assign actions
to events that occur on a uhid device.  For example, you can now make the
volume buttons on some newer keyboards actually do something.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.