File bcm20702a1-firmware.spec of Package bcm20702a1-firmware

# spec file for package bcm20702a1-firmware
# Copyright (c) 2020 SUSE LLC
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           bcm20702a1-firmware
Version:        1201650
Release:        0
Summary:        Firmware for BCM20702A1 based devices
License:        MIT
BuildRequires:  kernel-firmware
Requires:       kernel-firmware
Requires(post): bluez
Requires(post): coreutils
Requires(post): unzip
Requires(post): wget
# Another variant: bsc#1087996
Supplements:    modalias(usb:v0A5Cp21E6d*dcFFdsc01dp01icFFisc*ip*in*)
# Expand with more hardware if found
Supplements:    modalias(usb:v0A5Cp21E6d0112dcFFdsc01dp01icFFisc*ip*in*)
BuildArch:      noarch

Firmware for broadcom BCM20702A1 based devices present in various sticks and
laptops always over usb bridge.




OUT="$(mktemp -d)"
cd "$OUT"
wget -q{version} || :
if [ ! -f Bluetooth_V%{version} ]; then
    echo "Fatal error in obtaining the Windows bluetooth driver: Bluetooth_V%{version}"
    unzip Bluetooth_V%{version}
    cd Bluetooth
    hex2hcd BCM_DriverOnly/64/BCM20702A1_001.002.014.1443.1467.hex \
        -o BCM20702A1-0b05-17cb.hcd
    hex2hcd BCM_DriverOnly/64/BCM20702A1_001.002.014.1443.1469.hex \
        -o BCM20702A1-0b05-17cf.hcd
    hex2hcd BCM_DriverOnly/64/BCM20702A1_001.002.014.1483.1647.hex \
        -o BCM20702A1-05ac-21e1.hcd
    hex2hcd BCM_DriverOnly/64/BCM20702A1_001.002.014.1483.1669.hex \
        -o BCM20702A1-0a5c-21e6.hcd
    hex2hcd BCM_DriverOnly/64/BCM20702A1_001.002.014.1443.1467.hex \
        -o BCM20702A1-050d-065a.hcd
    mkdir -p /lib/firmware/brcm/
    install -m644 BCM20702A1-0b05-17cb.hcd /lib/firmware/brcm/BCM20702A1-0b05-17cb.hcd
    install -m644 BCM20702A1-0b05-17cf.hcd /lib/firmware/brcm/BCM20702A1-0b05-17cf.hcd
    install -m644 BCM20702A1-05ac-21e1.hcd /lib/firmware/brcm/BCM20702A1-05ac-21e1.hcd
    install -m644 BCM20702A1-0a5c-21e6.hcd /lib/firmware/brcm/BCM20702A1-0a5c-21e6.hcd
    install -m644 BCM20702A1-050d-065a.hcd /lib/firmware/brcm/BCM20702A1-050d-065a.hcd
# Another variant: bsc#1087996
wget -q || :
if [ ! -f fw-0a5c_21e8.hcd ]; then
    echo "Fatal error in obtaining the 0a5c:21e8 BT firmware"
    install -m644 fw-0a5c_21e8.hcd /lib/firmware/brcm/BCM20702A1-0a5c-21e8.hcd
rm -rf "$OUT"
exit 0

rm -f /lib/firmware/brcm/BCM20702A1-0b05-17cb.hcd
rm -f /lib/firmware/brcm/BCM20702A1-0b05-17cf.hcd
rm -f /lib/firmware/brcm/BCM20702A1-05ac-21e1.hcd
rm -f /lib/firmware/brcm/BCM20702A1-0a5c-21e6.hcd
rm -f /lib/firmware/brcm/BCM20702A1-0a5c-21e8.hcd
rm -f /lib/firmware/brcm/BCM20702A1-050d-065a.hcd
exit 0

%ghost /lib/firmware/brcm/BCM20702A1-0b05-17cb.hcd
%ghost /lib/firmware/brcm/BCM20702A1-0b05-17cf.hcd
%ghost /lib/firmware/brcm/BCM20702A1-05ac-21e1.hcd
%ghost /lib/firmware/brcm/BCM20702A1-0a5c-21e6.hcd
%ghost /lib/firmware/brcm/BCM20702A1-0a5c-21e8.hcd
%ghost /lib/firmware/brcm/BCM20702A1-050d-065a.hcd