Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bluetooth/iwmbtfw/main.c
Show First 20 Lines • Show All 435 Lines • ▼ Show 20 Lines | if (iwmbt_use_old_method) { | ||||
if (r < 0) { | if (r < 0) { | ||||
iwmbt_debug("iwmbt_enter_manufacturer() failed code %d", r); | iwmbt_debug("iwmbt_enter_manufacturer() failed code %d", r); | ||||
goto shutdown; | goto shutdown; | ||||
} | } | ||||
/* Download firmware and parse it for magic Intel Reset parameter */ | /* Download firmware and parse it for magic Intel Reset parameter */ | ||||
r = iwmbt_patch_firmware(hdl, firmware_path); | r = iwmbt_patch_firmware(hdl, firmware_path); | ||||
free(firmware_path); | free(firmware_path); | ||||
if (r < 0) | if (r < 0) { | ||||
(void)iwmbt_exit_manufacturer(hdl, 0x01); | |||||
goto shutdown; | goto shutdown; | ||||
} | |||||
iwmbt_info("Firmware download complete"); | iwmbt_info("Firmware download complete"); | ||||
/* Exit manufacturer mode */ | /* Exit manufacturer mode */ | ||||
r = iwmbt_exit_manufacturer(hdl, 0x02); | r = iwmbt_exit_manufacturer(hdl, r == 0 ? 0x00 : 0x02); | ||||
if (r < 0) { | if (r < 0) { | ||||
iwmbt_debug("iwmbt_exit_manufacturer() failed code %d", r); | iwmbt_debug("iwmbt_exit_manufacturer() failed code %d", r); | ||||
goto shutdown; | goto shutdown; | ||||
} | } | ||||
/* Once device is running in operational mode we can ignore failures */ | /* Once device is running in operational mode we can ignore failures */ | ||||
retcode = 0; | retcode = 0; | ||||
/* Execute Read Intel Version one more time */ | /* Execute Read Intel Version one more time */ | ||||
r = iwmbt_get_version(hdl, &ver); | r = iwmbt_get_version(hdl, &ver); | ||||
if (r == 0) | if (r == 0) | ||||
iwmbt_dump_version(&ver); | iwmbt_dump_version(&ver); | ||||
/* Set Intel Event mask */ | /* Set Intel Event mask */ | ||||
if (iwmbt_enter_manufacturer(hdl) < 0) | |||||
goto reset; | |||||
r = iwmbt_set_event_mask(hdl); | r = iwmbt_set_event_mask(hdl); | ||||
if (r == 0) | if (r == 0) | ||||
iwmbt_info("Intel Event Mask is set"); | iwmbt_info("Intel Event Mask is set"); | ||||
(void)iwmbt_exit_manufacturer(hdl, 0x00); | |||||
} else { | } else { | ||||
/* fw_variant = 0x06 bootloader mode / 0x23 operational mode */ | /* fw_variant = 0x06 bootloader mode / 0x23 operational mode */ | ||||
if (ver.fw_variant == 0x23) { | if (ver.fw_variant == 0x23) { | ||||
iwmbt_info("Firmware has already been downloaded"); | iwmbt_info("Firmware has already been downloaded"); | ||||
retcode = 0; | retcode = 0; | ||||
goto reset; | goto reset; | ||||
▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines |