diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..c0a5c54
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,10 @@
+BasedOnStyle: Google
+IndentWidth: 4
+TabWidth: 4
+UseTab: Never
+ColumnLimit: 100
+
+# pointers/references are aligned to the type
+PointerAlignment: Left
+# Include space after C-style cast
+SpaceAfterCStyleCast: true
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
new file mode 100644
index 0000000..12bb9f9
--- /dev/null
+++ b/.github/workflows/pre-commit.yml
@@ -0,0 +1,30 @@
+name: Lint and Pre-commit Checks
+permissions:
+ contents: read
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ workflow_dispatch:
+
+jobs:
+ pre-commit:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.x'
+
+ - name: Install pre-commit
+ run: pip install pre-commit
+
+ - name: Run pre-commit
+ run: pre-commit run --all-files
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..dc5bec7
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,24 @@
+exclude: ^uvcSupport/
+repos:
+ # General pre-commit hooks
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.5.0
+ hooks:
+ - id: trailing-whitespace
+ - id: end-of-file-fixer
+ - id: check-merge-conflict
+ - id: check-added-large-files
+ - id: check-case-conflict
+ - id: check-executables-have-shebangs
+ - id: check-shebang-scripts-are-executable
+ - id: check-yaml
+ - id: check-json
+ - id: check-xml
+ - id: mixed-line-ending
+ args: ['--fix=lf']
+
+
+ - repo: https://github.com/pre-commit/mirrors-clang-format
+ rev: v14.0.6
+ hooks:
+ - id: clang-format
diff --git a/LICENSE b/LICENSE
index 7781cc8..7af7d9f 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,8 +1,8 @@
Copyright (c) 2018 Brookhaven Science Associates, as Operator
of Brookhaven National Laboratory
-
+
All Rights Reserved
-
+
Area detector USB Video Class (UVC) device driver implementation
Photon Sciences Division
@@ -16,41 +16,41 @@ EXCEPTIONS
OPEN SOURCE LICENSE
-
-Redistribution and use in source and binary forms, with or without
+
+Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer. Software changes,
- modifications, or derivative works, should be noted with comments and
+
+1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer. Software changes,
+ modifications, or derivative works, should be noted with comments and
the author and organization's name.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
+ this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. Neither the names of Brookhaven Science Associates, Brookhaven National
Laboratory, or the Department of Energy nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
-
-4. The software and the end-user documentation included with the
+
+4. The software and the end-user documentation included with the
redistribution, if any, must include the following acknowledgment:
-
- "This product includes software produced with the support of the
+
+ "This product includes software produced with the support of the
Brookhaven National Laboratory Photon Sciences division."
-
+
****************************************************************************
-
+
DISCLAIMER
-
+
THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT WARRANTY OF ANY KIND.
-
-Neither the United States GOVERNMENT, nor the United States Department
-of Energy, NOR Brookhaven National Laboratory, LLC, nor any of their employees, makes
-any warranty, express or implied, or assumes any legal liability or
-responsibility for the accuracy, completeness, or usefulness of any
-information, data, apparatus, product, or process disclosed, or
+
+Neither the United States GOVERNMENT, nor the United States Department
+of Energy, NOR Brookhaven National Laboratory, LLC, nor any of their employees, makes
+any warranty, express or implied, or assumes any legal liability or
+responsibility for the accuracy, completeness, or usefulness of any
+information, data, apparatus, product, or process disclosed, or
represents that its use would not infringe privately owned rights.
-
-****************************************************************************
\ No newline at end of file
+
+****************************************************************************
diff --git a/README.md b/README.md
index 9b40243..8bfe206 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
An [EPICS](www.aps.anl.gov/epics) [areaDetector](https://github.com/areaDetector/areaDetector/blob/master/README.md) driver for communicating with USB Video Class (UVC) devices, including consumer webcams and some industrial cameras, using the open source [libuvc library](https://github.com/libuvc/libuvc).
-The driver has been tested on 64 bit linux only, but it is possible that it will also work on windows and other architectures as well.
+The driver has been tested on 64 bit linux only, but it is possible that it will also work on windows and other architectures as well.
It was tested with many devices, including the following:
diff --git a/RELEASE.md b/RELEASE.md
index 5429e95..0b6c91e 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -1,6 +1,6 @@
# ADUVC RELEASES
-Author: Jakub Wlodek
+Author: Jakub Wlodek
ADUVC requires libusb, libuvc, epics-base, epics-modules, ADCore, and ADSupport. Further installation information can be found in the README file.
@@ -30,7 +30,7 @@ R1-7 (27-January-2023)
* Fixes
* Minor bug with continuous acquisition mode fixed
* Avoid "Auto Adjust" as default behavior
-
+
R1-6 (1-December-2020)
----
@@ -64,9 +64,9 @@ R1-4 (18-August-2020)
* Allow for helper utilities to compile with non-system installed libuvc
* Known Issues
- * `libuvc` relies on `libusb-1.0`, not `libusb`.
+ * `libuvc` relies on `libusb-1.0`, not `libusb`.
* When camera is not connected, driver segmentation faults - should be handled more gracefully.
-
+
R1-3 (06-September-2019)
-----
@@ -113,7 +113,7 @@ R1-1 (28-January-2019)
* Updated documentation with params[in]/[out]
* Added LICENSE
* Code formatting cleaned up (removed all tab characters)
-
+
R1-0 (7-December-2018)
-----
@@ -131,7 +131,7 @@ R1-0 (7-December-2018)
R0-1 (Beta) (5-November-2018)
-----
-* Key detector features implemented:
+* Key detector features implemented:
* Image Acquisition supported and tested.
* Acquisition mode selection supported and tested
* Diagnostic information acquisition
diff --git a/configure/CONFIG b/configure/CONFIG
index 6054d1a..331fd70 100644
--- a/configure/CONFIG
+++ b/configure/CONFIG
@@ -25,4 +25,4 @@ include $(TOP)/configure/CONFIG_SITE
ifdef T_A
-include $(TOP)/configure/CONFIG_SITE.Common.$(T_A)
-include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A)
-endif
\ No newline at end of file
+endif
diff --git a/configure/CONFIG_SITE b/configure/CONFIG_SITE
index dc6e104..4df968f 100644
--- a/configure/CONFIG_SITE
+++ b/configure/CONFIG_SITE
@@ -39,4 +39,4 @@ CHECK_RELEASE = YES
ifdef T_A
-include $(AREA_DETECTOR)/configure/CONFIG_SITE.Common.$(T_A)
-include $(AREA_DETECTOR)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A)
-endif
\ No newline at end of file
+endif
diff --git a/configure/Makefile b/configure/Makefile
index e9e1078..9254309 100644
--- a/configure/Makefile
+++ b/configure/Makefile
@@ -5,4 +5,4 @@ include $(TOP)/configure/CONFIG
TARGETS = $(CONFIG_TARGETS)
CONFIGS += $(subst ../,,$(wildcard $(CONFIG_INSTALLS)))
-include $(TOP)/configure/RULES
\ No newline at end of file
+include $(TOP)/configure/RULES
diff --git a/configure/RELEASE b/configure/RELEASE
index be6b9c3..e835000 100644
--- a/configure/RELEASE
+++ b/configure/RELEASE
@@ -4,4 +4,4 @@
-include $(TOP)/../configure/RELEASE_LIBS_INCLUDE
-include $(TOP)/RELEASE.local
--include $(TOP)/configure/RELEASE.local
\ No newline at end of file
+-include $(TOP)/configure/RELEASE.local
diff --git a/configure/RULES b/configure/RULES
index b0054ec..6d56e14 100644
--- a/configure/RULES
+++ b/configure/RULES
@@ -3,4 +3,4 @@
include $(CONFIG)/RULES
# Library should be rebuilt because LIBOBJS may have changed.
-$(LIBNAME): ../Makefile
\ No newline at end of file
+$(LIBNAME): ../Makefile
diff --git a/configure/RULES.ioc b/configure/RULES.ioc
index 151337e..901987c 100644
--- a/configure/RULES.ioc
+++ b/configure/RULES.ioc
@@ -1,2 +1,2 @@
#RULES.ioc
-include $(CONFIG)/RULES.ioc
\ No newline at end of file
+include $(CONFIG)/RULES.ioc
diff --git a/configure/RULES_DIRS b/configure/RULES_DIRS
index ad50f9a..3ba269d 100644
--- a/configure/RULES_DIRS
+++ b/configure/RULES_DIRS
@@ -1,2 +1,2 @@
#RULES_DIRS
-include $(CONFIG)/RULES_DIRS
\ No newline at end of file
+include $(CONFIG)/RULES_DIRS
diff --git a/configure/RULES_TOP b/configure/RULES_TOP
index 334a29f..2b8cbc6 100644
--- a/configure/RULES_TOP
+++ b/configure/RULES_TOP
@@ -1,2 +1,2 @@
#RULES_TOP
-include $(CONFIG)/RULES_TOP
\ No newline at end of file
+include $(CONFIG)/RULES_TOP
diff --git a/docs/ADUVC/ADUVC.rst b/docs/ADUVC/ADUVC.rst
index 1e0cde4..76380dc 100644
--- a/docs/ADUVC/ADUVC.rst
+++ b/docs/ADUVC/ADUVC.rst
@@ -17,7 +17,7 @@ An EPICS driver for USB Video Class (UVC) devices
.. _libuvc: https://github.com/ktossell/libuvc
.. _ADUVC: https://github.com/epicsNSLS2-areaDetector/ADUVC
.. _areaDetector: https://github.com/areaDetector
-
+
Overview
--------
@@ -56,7 +56,7 @@ Issues with root ownership of UVC devices
-----------------------------------------
The USB camera device is typically owned by root, which prevents EPICS IOC from running as softioc user, and automatic startup using procServer. To grant access to USB camera device by other users, such as softioc, we wrote udev rules::
-
+
kgofron@xf17bm-ioc2:/etc/udev/rules.d$ more usb-cams.rules
# cam1 f007
SUBSYSTEM=="usb", ATTRS{idVendor}=="f007", OWNER="softioc", GROUP="softioc", MODE="0666", SYMLINK="cam1"
@@ -160,7 +160,7 @@ Release Notes
- Allow for helper utilities to compile with non-system installed libuvc
- Known Issues
-
+
- libuvc relies on libusb-1.0, not libusb.
- When camera is not connected, driver segmentation faults; should be handled more gracefully.
@@ -293,9 +293,9 @@ Known Issues and pull requests
------------------------------
- To submit an issue or a pull request for ADUVC, please do so at the source fork on `Github
- UVC, or USB Video Class is an open Video connection standard used for USB based cameras and webcams. Almost all consumer webcams support
+ UVC, or USB Video Class is an open Video connection standard used for USB based cameras and webcams. Almost all consumer webcams support
UVC, along with a large number of other consumer USB cameras of different form factors, ranging from pencil cameras to micro cameras.
Some industrial cameras support the format as well. ADUVC is an area detector driver that adds support for UVC based cameras.
It also includes some useful test programs to check if your UVC device is being recognized correctly.
@@ -28,8 +28,8 @@ Corresponding author: Kazimierz Gofron
Introduction:
Installation:
file. To install ADUVC, you must first install libuvc and its dependancies. The simplest way to do this is to run the provided
bash script in the adUVCSupport directory of the repository. This installs libusub, libjpeg, and cmake, clones the
libuvc repository on github, and then builds it using cmake. The dynamic library files
- resulting from the build are placed in the /usr/local directory (on Linux), and include files must be placed in adUVCSupport/include.
- From here you may compile the support programs or the driver itself by entering the appropriate directory (the top ADUVC dir. for the
+ resulting from the build are placed in the /usr/local directory (on Linux), and include files must be placed in adUVCSupport/include.
+ From here you may compile the support programs or the driver itself by entering the appropriate directory (the top ADUVC dir. for the
driver), and compiling by switching to root and typing 'make'. The driver is now installed.