summaryrefslogtreecommitdiff
path: root/sys/dev/adb
AgeCommit message (Collapse)Author
2024-12-06Replace calls to bus_generic_attach with bus_attach_childrenJohn Baldwin
Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47675
2024-11-04Use bus_generic_detach directly instead of a wrapperJohn Baldwin
Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47386
2024-07-24newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANYWarner Losh
Sponsored by: Netflix
2023-11-26sys: Automated cleanup of cdefs and other formattingWarner Losh
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
2023-08-16sys: Remove $FreeBSD$: one-line sh patternWarner Losh
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16sys: Remove $FreeBSD$: two-line .h patternWarner Losh
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-07-06kbd: consolidate kb interfaces (phase one)Michael
Refactor to eliminate duplicated rate and delay tables, with minor style tweaks for changed lines. Remove an obsolete comment about needing to convert from microseconds to ticks (that's done elsewhere). Remove traiing whitespace in kbdcontrol.c. Except for the new warning, no change in behavior Sponsored by: DSS GmbH Reviewed by: imp [minor style tweaks as well] Pull Request: https://github.com/freebsd/pull/683 Differential Revision: https://reviews.freebsd.org/D38818
2023-05-12spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
2023-02-14sys/kbio.h: make pre-unicode keymap support optionalStefan Eßer
FreeBSD-9 had introduced support for the full set of Unicode characters to the parsing and processing of keymap character tables. This support has been extended to cover the table for accented characters that are reached via dead key combinations in FreeBSD-13.2. New ioctls have been introduced to support both the pre-Unicode and the Unicode formats and keyboard drivers have been extended to support those ioctls. This commit makes the ABI compatibility functions in the kernel optional and dependent on COMPAT_FREEBSD13 in -CURRENT. The kbdcontrol command in -CURRENT and 13-STABLE (before 13.2) has been made ABI compatible with old kernels to allow a new world to be run on an old kernel (that does not have full Unicode support for keymaps). This commit is not to merged back to 12-STABLE or 13-STABLE. It is part of review D38465, which has been split into 3 separate commits due to different MFC and life-time requirements of either commit. Approved by: imp Differential Revision: https://reviews.freebsd.org/D38465
2023-02-06Support Unicode characters in keymap dead key tablesStefan Eßer
Support for Unicode characters had been added to the keyboard code, but there are keymaps that have accented characters accessed via dead key combinations, and those were still restricted to 8 bit codes. This update to kbd.c adds support for Unicode characters and compatibility code that allows a kbdcontrol command built from kbio.h without these patches to work on a new kernel. Compatibility code that allows a new kbdcontrol binary running on an old kernel to load and display the dead key map will be committed in a separate commit. Reviewed by: imp, brooks Approved by: brooks MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D38381
2022-05-10adb: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin
2022-05-10Remove unused adb_devclass.John Baldwin
2020-09-01adb: clean up empty lines in .c and .h filesMateusz Guzik
Notes: svn path=/head/; revision=365099
2020-02-26Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
2019-12-26Revert r355806: kbd drivers: don't double register keyboard driversKyle Evans
r356087 made it rather innocuous to double-register built-in keyboard drivers; we now set a flag to indicate that it's been registered and only act once on a registration anyways. There is no misleading here, as the follow-up kbd_delete_driver will actually remove the driver as needed now that the linker set isn't also consulted after kbdinit. Notes: svn path=/head/; revision=356091
2019-12-16kbd drivers: don't double register keyboard driversKyle Evans
Keyboard drivers are generally registered via linker set. In these cases, they're also available as kmods which use KPI for registering/unregistering keyboard drivers outside of the linker set. For built-in modules, we still fire off MOD_LOAD and maybe even MOD_UNLOAD if an error occurs, leading to registration via linker set and at MOD_LOAD time. This is a minor optimization at best, but it keeps the internal kbd driver tidy as a future change will merge the linker set driver list into its internal keyboard_drivers list via SYSINIT and simplify driver lookup by removing the need to consult the linker set. Notes: svn path=/head/; revision=355806
2019-12-16kbd: provide default implementations of get_fkeystr/diagKyle Evans
Most keyboard drivers are using the genkbd implementations as it is; formally use them for any that aren't set and make genkbd_get_fkeystr/genkbd_diag private. Notes: svn path=/head/; revision=355796
2019-12-16keyboard switch definitions: standardize on c99 initializersKyle Evans
A future change will provide default implementations for some of these where it makes sense and most of them are already using the genkbd implementation (e.g. get_fkeystr, diag). Notes: svn path=/head/; revision=355794
2019-05-20Extract eventfilter declarations to sys/_eventfilter.hConrad Meyer
This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h" in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header pollution substantially. EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c files into appropriate headers (e.g., sys/proc.h, powernv/opal.h). As a side effect of reduced header pollution, many .c files and headers no longer contain needed definitions. The remainder of the patch addresses adding appropriate includes to fix those files. LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by sys/mutex.h since r326106 (but silently protected by header pollution prior to this change). No functional change (intended). Of course, any out of tree modules that relied on header pollution for sys/eventhandler.h, sys/lock.h, or sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped. Notes: svn path=/head/; revision=347984
2017-11-27sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni
Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
2017-01-30Force the setting of bit 7 in the sysmouse packet byte 1 to be unsigned.Justin Hibbits
Clang complains about the shift of (1 << 7) into a int8_t changing the value: warning: implicit conversion from 'int' to 'int8_t' (aka 'signed char') changes value from 128 to -128 [-Wconstant-conversion] Squash this warning by forcing clang to see it as an unsigned bit. This seems odd, given that it's still a conversion of 128->-128, but I'm guessing the explicit unsigned attribute notifies clang that sign really doesn't matter in this case. Reported by: Mark Millard <markmi AT dsl-only DOT net> MFC after: 2 weeks Notes: svn path=/head/; revision=312977
2016-04-21sys: use our roundup2/rounddown2() macros when param.h is available.Pedro F. Giffuni
rounddown2 tends to produce longer lines than the original code and when the code has a high indentation level it was not really advantageous to do the replacement. This tries to strike a balance between readability using the macros and flexibility of having the expressions, so not everything is converted. Notes: svn path=/head/; revision=298433
2016-04-19sys/dev: use our nitems() macro when it is avaliable through param.h.Pedro F. Giffuni
No functional change, only trivial cases are done in this sweep, Drivers that can get further enhancements will be done independently. Discussed in: freebsd-current Notes: svn path=/head/; revision=298307
2014-06-21No need to check if devd is running before posting an event.Justin Hibbits
Notes: svn path=/head/; revision=267697
2014-01-23Properly sort the arguments to mtx_init(9).Justin Hibbits
PR: misc/186020 Submitted by: alfred MFC after: 1 week Notes: svn path=/head/; revision=261068
2013-10-29Return NOKEY instead of 0 if there are no more key presses queued. ThisNathan Whitehorn
worked by accident if and only if akbd was part of a kbdmux (which it always was in practice). MFC after: 1 week Notes: svn path=/head/; revision=257295
2013-09-28Fix powerpc/161045. ams_poll() needs to return that any data is available, notJustin Hibbits
just a new packet. PR: powerpc/161045 Approved by: re(marius) MFC after: 1 week Notes: svn path=/head/; revision=255921
2012-11-13Use uiomove return value instead of returning 0.Kevin Lo
Notes: svn path=/head/; revision=242948
2012-06-23Release the ADB keyboard mutex when handling the power buttonJustin Hibbits
press/release. Found by WITNESS. Approved by: nwhitehorn (mentor) MFC after: 3 days Notes: svn path=/head/; revision=237480
2011-10-16Add support for special keys (volume/brightness/eject) on Apple laptops withNathan Whitehorn
ADB keyboards. Submitted by: Justin Hibbits <jrh29 at alumni dot cwru dot edu> MFC after: 9.0-RELEASE Notes: svn path=/head/; revision=226449
2011-07-17Restore binary compatibility for GIO_KEYMAP and PIO_KEYMAP.Ed Schouten
Back in 2009 I changed the ABI of the GIO_KEYMAP and PIO_KEYMAP ioctls to support wide characters. I created a patch to add ABI compatibility for the old calls, but I didn't get any feedback to that. It seems now people are upgrading from 8 to 9 they experience this issue, so add it anyway. Notes: svn path=/head/; revision=224126
2009-11-28Add support for interpreting taps on ADB touchpads as a button click.Nathan Whitehorn
Submitted by: Andreas Tobler <andreast-list at fgznet dot ch> MFC after: 2 weeks Notes: svn path=/head/; revision=199888
2009-08-20Temporarily revert the new-bus locking for 8.0 release. It will beJohn Baldwin
reintroduced after HEAD is reopened for commits by re@. Approved by: re (kib), attilio Notes: svn path=/head/; revision=196403
2009-08-02Make the newbus subsystem Giant free by adding the new newbus sxlock.Attilio Rao
The newbus lock is responsible for protecting newbus internIal structures, device states and devclass flags. It is necessary to hold it when all such datas are accessed. For the other operations, softc locking should ensure enough protection to avoid races. Newbus lock is automatically held when virtual operations on the device and bus are invoked when loading the driver or when the suspend/resume take place. For other 'spourious' operations trying to access/modify the newbus topology, newbus lock needs to be automatically acquired and dropped. For the moment Giant is also acquired in some key point (modules subsystem) in order to avoid problems before the 8.0 release as module handlers could make assumptions about it. This Giant locking should go just after the release happens. Please keep in mind that the public interface can be expanded in order to provide more support, if there are really necessities at some point and also some bugs could arise as long as the patch needs a bit of further testing. Bump __FreeBSD_version in order to reflect the newbus lock introduction. Reviewed by: ed, hps, jhb, imp, mav, scottl No answer by: ariff, thompsa, yongari Tested by: pho, G. Trematerra <giovanni dot trematerra at gmail dot com>, Brandon Gooch <jamesbrandongooch at gmail dot com> Sponsored by: Yahoo! Incorporated Approved by: re (ksmith) Notes: svn path=/head/; revision=196037
2009-01-29Use si_drv1 to hold the softc for the adb_mouse character device instead ofJohn Baldwin
using devclass_get_softc(). Tested by: nwhitehorn Notes: svn path=/head/; revision=187893
2009-01-29Make adb_mouse use dev2unit() instead of minor().Ed Schouten
A real fix would be to migrate it to si_drv0 to store the softc directly, but this is the quickest way to fix it right now. Notes: svn path=/head/; revision=187878
2009-01-08Improve the AT keyboard emulation of the ADB keyboard driver, by supportingNathan Whitehorn
an AT-like K_RAW mode instead of just K_CODE. This has the effect of making the arrow keys on ADB keyboards work in X11. Copied from: sunkbd(4) Notes: svn path=/head/; revision=186906
2008-12-06Fix some nasty race conditions in the VIA-CUDA driver that ended up preventingNathan Whitehorn
my right mouse button and keyboard LEDs from working due to mangled configuration packets. Fixed several other races and associated problems in the main ADB stack that were exposed while fixing this. Notes: svn path=/head/; revision=185724
2008-11-12Probe ADB miscellaneous devices (ID 7) instead of stopping at ID 6. ThisNathan Whitehorn
allows us to probe the brightness and volume control buttons on PPC Apple laptops, though there is not yet a driver to do anything useful with them. Notes: svn path=/head/; revision=184890
2008-11-02Make the touch pad on my PowerBook G4 12" a little more usable.Ed Schouten
For an unknown reason the touch pad of my PowerBook generates button 5 events when you operate it. This causes the adb_mouse code to convert them to button 2 events, which is not what we want. Add a new flag, AMS_TOUCHPAD, which is used to distinguish the touch pad. When set, don't convert button events of unknown buttons to the last button. There are still three problems left with respect to user input: - The mouse button events are not properly processed when the touch pad isn't touched. - The arrow keys on the keyboard don't work inside X11. - The power button isn't handled by the kernel, similar to the ACPI power button on i386/amd64. Approved by: nwhitehorn Notes: svn path=/head/; revision=184565
2008-11-01Allow a read() on /dev/ams[0-9] to be interrupted.Ed Schouten
Right now ams_read() uses cv_wait() to wait for new data to arrive on the mouse device. This means that when you run `cat /dev/ams0', it cannot be interrupted directly. After you press ^C, you first need to move the mouse before cat will quit. Make this function use cv_wait_sig(), which allows it to be interrupted directly. Reviewed by: nwhitehorn Notes: svn path=/head/; revision=184520
2008-10-30Fix some possible infinite loops in the ADB code, and remove some hacksNathan Whitehorn
that were inserted in desperation during bring-up. In addition, move ADB bus enumeration and child attachment to when interrupts are available. Notes: svn path=/head/; revision=184473
2008-10-26Add ADB support. This provides support for the external ADB bus on the PowerMacNathan Whitehorn
G3 as well as the internal ADB keyboard and mice in PowerBooks and iBooks. This also brings in Mac GPIO support, for which we should eventually have a better interface. Obtained from: NetBSD (CUDA and PMU drivers) Notes: svn path=/head/; revision=184299