2021-02-05 17:12:51 +00:00
|
|
|
{ stdenv, lib, fetchurl, pkg-config, makeWrapper
|
2020-11-24 20:58:05 +00:00
|
|
|
, libusb1, tcl, util-linux, coreutils, bash }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "usb-modeswitch";
|
|
|
|
version = "2.6.0";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "http://www.draisberghof.de/usb_modeswitch/${pname}-${version}.tar.bz2";
|
|
|
|
sha256 = "18wbbxc5cfsmikba0msdvd5qlaga27b32nhrzicyd9mdddp265f2";
|
|
|
|
};
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
patches = [
|
|
|
|
./configurable-usb-modeswitch.patch
|
|
|
|
./pkg-config.patch
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Remove attempts to write to /etc and /var/lib.
|
|
|
|
postPatch = ''
|
|
|
|
sed -i \
|
|
|
|
-e '/^\tinstall .* usb_modeswitch.conf/s,$(ETCDIR),$(out)/etc,' \
|
|
|
|
-e '\,^\tinstall -d .*/var/lib/usb_modeswitch,d' \
|
|
|
|
Makefile
|
|
|
|
'';
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=$(out)"
|
|
|
|
"ETCDIR=/etc"
|
|
|
|
"USE_UPSTART=false"
|
|
|
|
"USE_SYSTEMD=true"
|
|
|
|
"SYSDIR=$(out)/lib/systemd/system"
|
|
|
|
"UDEVDIR=$(out)/lib/udev"
|
|
|
|
];
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
wrapProgram $out/bin/usb_modeswitch_dispatcher \
|
2020-11-24 20:58:05 +00:00
|
|
|
--set PATH ${lib.makeBinPath [ util-linux coreutils bash ]}
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildInputs = [ libusb1 tcl ];
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config makeWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Mode switching tool for controlling 'multi-mode' USB devices";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ marcweber peterhoeg ];
|
|
|
|
platforms = platforms.linux;
|
2024-09-26 11:04:55 +00:00
|
|
|
mainProgram = "usb_modeswitch";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|