Skip to content

Commit

Permalink
Merge pull request #38 from lsst-it/dracal-usb-pth450
Browse files Browse the repository at this point in the history
Add support for Dracal USB PTH450
  • Loading branch information
glennmorris authored Jun 14, 2024
2 parents 01e5574 + cc157d9 commit a80fccf
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 0 deletions.
28 changes: 28 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* [`ccs_hcu::ft4232h`](#ccs_hcu--ft4232h): Add settings for FT4232H device.
* [`ccs_hcu::imanager`](#ccs_hcu--imanager): Add (or remove) the iManager module.
* [`ccs_hcu::power`](#ccs_hcu--power): Add (or remove) hcu shutdown utilities
* [`ccs_hcu::pth450`](#ccs_hcu--pth450): Install Dracal USB pth450 support.
* [`ccs_hcu::shutter`](#ccs_hcu--shutter): Install shutter utilities.
* [`ccs_hcu::vldrive`](#ccs_hcu--vldrive): Add (or remove) the lion vldrive module.

Expand All @@ -38,6 +39,7 @@ The following parameters are available in the `ccs_hcu` class:
* [`aiousb`](#-ccs_hcu--aiousb)
* [`shutter`](#-ccs_hcu--shutter)
* [`ft4232h`](#-ccs_hcu--ft4232h)
* [`pth450`](#-ccs_hcu--pth450)
* [`pkgurl`](#-ccs_hcu--pkgurl)
* [`pkgurl_user`](#-ccs_hcu--pkgurl_user)
* [`pkgurl_pass`](#-ccs_hcu--pkgurl_pass)
Expand Down Expand Up @@ -109,6 +111,14 @@ true or false to enable ft4232h.

Default value: `false`

##### <a name="-ccs_hcu--pth450"></a>`pth450`

Data type: `Boolean`

True to install Dracal USB-PTH450 sensor support.

Default value: `false`

##### <a name="-ccs_hcu--pkgurl"></a>`pkgurl`

Data type: `String`
Expand Down Expand Up @@ -258,6 +268,24 @@ Boolean true on quadbox hosts

Default value: `false`

### <a name="ccs_hcu--pth450"></a>`ccs_hcu::pth450`

Install Dracal USB pth450 support.

#### Parameters

The following parameters are available in the `ccs_hcu::pth450` class:

* [`tarfile`](#-ccs_hcu--pth450--tarfile)

##### <a name="-ccs_hcu--pth450--tarfile"></a>`tarfile`

Data type: `String`

Name of tarfile to install.

Default value: `'dracalview-client-bin-3.2.2.tar.xz'`

### <a name="ccs_hcu--shutter"></a>`ccs_hcu::shutter`

Install shutter utilities.
Expand Down
13 changes: 13 additions & 0 deletions files/70-dracal.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This file is managed by Puppet; changes may be overwritten.
SUBSYSTEM=="usb", ATTR{idVendor}=="1781", ATTR{idProduct}=="0a98", GROUP="dialout", MODE="0664"
SUBSYSTEM=="usb", ATTR{idVendor}=="289b", ATTR{idProduct}=="0500", GROUP="dialout", MODE="0664"
SUBSYSTEM=="usb", ATTR{idVendor}=="289b", ATTR{idProduct}=="0501", GROUP="dialout", MODE="0664"
SUBSYSTEM=="usb", ATTR{idVendor}=="289b", ATTR{idProduct}=="0502", GROUP="dialout", MODE="0664"
SUBSYSTEM=="usb", ATTR{idVendor}=="289b", ATTR{idProduct}=="0503", GROUP="dialout", MODE="0664"
SUBSYSTEM=="usb", ATTR{idVendor}=="289b", ATTR{idProduct}=="0504", GROUP="dialout", MODE="0664"
SUBSYSTEM=="usb", ATTR{idVendor}=="289b", ATTR{idProduct}=="0505", GROUP="dialout", MODE="0664"
SUBSYSTEM=="usb", ATTR{idVendor}=="289b", ATTR{idProduct}=="0506", GROUP="dialout", MODE="0664"
SUBSYSTEM=="usb", ATTR{idVendor}=="289b", ATTR{idProduct}=="0507", GROUP="dialout", MODE="0664"
SUBSYSTEM=="usb", ATTR{idVendor}=="289b", ATTR{idProduct}=="0508", GROUP="dialout", MODE="0664"
SUBSYSTEM=="usb", ATTR{idVendor}=="289b", ATTR{idProduct}=="0509", GROUP="dialout", MODE="0664"
SUBSYSTEM=="usb", ATTR{idVendor}=="289b", ATTR{idProduct}=="0510", GROUP="dialout", MODE="0664"
11 changes: 11 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
# True to install shutter utilities.
# @param ft4232h
# true or false to enable ft4232h.
# @param pth450
# True to install Dracal USB-PTH450 sensor support.
# @param pkgurl
# String specifying URL to fetch sources from.
# @param pkgurl_user
Expand All @@ -35,6 +37,7 @@
Variant[Boolean,String] $filter_changer = false,
Boolean $aiousb = false,
Boolean $ft4232h = false,
Boolean $pth450 = false,
Boolean $shutter = false,
String $pkgurl = 'https://example.org',
Variant[Sensitive[String[1]],String[1]] $pkgurl_user = Sensitive('someuser'),
Expand All @@ -56,6 +59,10 @@

$opts = Hash(flatten($opts1))

## Frequently needed on HCUs.
## The -devel packages in the ccs_hcu role (easier due to crb repo).
ensure_packages(['libusb'])

class { 'ccs_hcu::power':
ensure => present,
quadbox => $quadbox,
Expand Down Expand Up @@ -88,4 +95,8 @@
if $aiousb {
include ccs_hcu::aiousb
}

if $pth450 {
include ccs_hcu::pth450
}
}
48 changes: 48 additions & 0 deletions manifests/pth450.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# @summary
# Install Dracal USB pth450 support.
#
# @param tarfile
# Name of tarfile to install.
#
class ccs_hcu::pth450 (
String $tarfile = 'dracalview-client-bin-3.2.2.tar.xz',
) {
$ptitle = regsubst($title, '::.*', '', 'G')

$bindir = '/usr/local/bin'

archive { "/var/tmp/${tarfile}":
ensure => present,
source => "${ccs_hcu::pkgurl}/${tarfile}",
username => $ccs_hcu::pkgurl_user.unwrap,
password => $ccs_hcu::pkgurl_pass.unwrap,
extract => true,
extract_path => $bindir,
extract_command => 'tar --no-same-owner -axf %s',
cleanup => false,
user => 'root',
group => 'root',
## It creates some other files too.
creates => "${bindir}/dracal-usb-get",
}

## Add udev rule to set permissions.
$udev = '70-dracal.rules'

file { "/etc/udev/rules.d/${udev}":
ensure => 'file',
source => "puppet:///modules/${ptitle}/${udev}",
notify => Exec['udevadm pth450'],
}

exec { 'udevadm pth450':
path => ['/usr/sbin', '/usr/bin'],
# lint:ignore:strict_indent
command => @("CMD"/L),
sh -c 'udevadm control --reload-rules && \
udevadm trigger --type=devices --action=change'
| CMD
# lint:endignore
refreshonly => true,
}
}

0 comments on commit a80fccf

Please sign in to comment.