diff options
Diffstat (limited to 'nixpkgs/pkgs/tools/misc/sixpair')
-rw-r--r-- | nixpkgs/pkgs/tools/misc/sixpair/default.nix | 40 | ||||
-rw-r--r-- | nixpkgs/pkgs/tools/misc/sixpair/hcitool.patch | 19 |
2 files changed, 59 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/misc/sixpair/default.nix b/nixpkgs/pkgs/tools/misc/sixpair/default.nix new file mode 100644 index 000000000000..fa444a86a0ac --- /dev/null +++ b/nixpkgs/pkgs/tools/misc/sixpair/default.nix @@ -0,0 +1,40 @@ +{ lib, stdenv, fetchurl, libusb-compat-0_1 }: +stdenv.mkDerivation { + pname = "sixpair"; + version = "unstable-2007-04-18"; + + src = fetchurl { + url = "http://www.pabr.org/sixlinux/sixpair.c"; + sha256 = "1b0a3k7gs544cbji7n29jxlrsscwfx6s1r2sgwdl6hmkc1l9gagr"; + }; + + # hcitool is depricated + patches = [ ./hcitool.patch ]; + + buildInputs = [ libusb-compat-0_1 ]; + + unpackPhase = '' + cp $src sixpair.c + ''; + + buildPhase = '' + cc -o sixpair sixpair.c -lusb + ''; + + installPhase = '' + mkdir -p $out/bin + cp sixpair $out/bin/sixpair + ''; + + meta = { + description = "Pair with SIXAXIS controllers over USB"; + longDescription = '' + This command-line utility searches USB buses for SIXAXIS controllers and tells them to connect to a new Bluetooth master. + ''; + homepage = "http://www.pabr.org/sixlinux/"; + license = lib.licenses.gpl2; + maintainers = [ lib.maintainers.tomsmeets ]; + platforms = lib.platforms.linux; + mainProgram = "sixpair"; + }; +} diff --git a/nixpkgs/pkgs/tools/misc/sixpair/hcitool.patch b/nixpkgs/pkgs/tools/misc/sixpair/hcitool.patch new file mode 100644 index 000000000000..b66e791dd0e0 --- /dev/null +++ b/nixpkgs/pkgs/tools/misc/sixpair/hcitool.patch @@ -0,0 +1,19 @@ +diff --git a/sixpair.c b/sixpair.c +index b009a6f..78b7ef0 100644 +--- a/sixpair.c ++++ b/sixpair.c +@@ -76,11 +76,11 @@ void process_device(int argc, char **argv, struct usb_device *dev, + exit(1); + } + } else { +- FILE *f = popen("hcitool dev", "r"); ++ FILE *f = popen("bluetoothctl list", "r"); + if ( !f || +- fscanf(f, "%*s\n%*s %x:%x:%x:%x:%x:%x", ++ fscanf(f, "%*s %x:%x:%x:%x:%x:%x", + &mac[0],&mac[1],&mac[2],&mac[3],&mac[4],&mac[5]) != 6 ) { +- printf("Unable to retrieve local bd_addr from `hcitool dev`.\n"); ++ printf("Unable to retrieve local bd_addr from `bluetoothctl list`.\n"); + printf("Please enable Bluetooth or specify an address manually.\n"); + exit(1); + } |