Code Monkey home page Code Monkey logo

homekitadk's Introduction

HomeKit Accessory Development Kit (ADK)

The HomeKit ADK is used by silicon vendors and accessory manufacturers to build HomeKit compatible devices.

The HomeKit ADK implements key components of the HomeKit Accessory Protocol (HAP), which embodies the core principles Apple brings to smart home technology: security, privacy, and reliability.

The HomeKit Open Source ADK is an open-source version of the HomeKit Accessory Development Kit. It can be used by any developer to prototype non-commercial smart home accessories. For commercial accessories, accessory developers must continue to use the commercial version of the HomeKit ADK available through the MFi Program.

Go to the Apple Developer Site if you like to learn more about developing HomeKit-enabled accessories and apps.

Getting Started

Please go through Getting Started Guide before using HomeKit ADK.

Documentation

ADK documentation is available as markdown files in Documentation directory. However, a more user friendly HTML documentation can be generated from the markdown files by running the following command:

make docs

The command above will prompt to open the generated HTML webpage. After the command has finished, the webpage ./Documentation/api_docs/html/index.html can also be opened in a browser.

homekitadk's People

Contributors

aajain-com avatar abyrne-w avatar carol-apple avatar carricdsilva-apple avatar clovel avatar cpfister avatar ddealmei avatar joebelford avatar kevinmarty avatar leonrinkel avatar modestgoblin avatar pgravel-com avatar rojer avatar rojer9-fb avatar signalwerk avatar stokito avatar zebin-wu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

homekitadk's Issues

FR: SPM Integration

Would be nice to add and use this project through Swift Package Manager, if possible.

Characteristic database

Currently ADK requires you to define a number of (boilerplate) services and characteristics just to start writing the actual accessory logic which results in huge copy pasted declarations. For particular characteristic (let's say FirmwareRevision) all settings are the same every time, with exception of callbacks and maybe custom ranges (e.g. for TargetTemperature characteristic). It would make sense to automate filling most characteristic fields by using a set of macros: it's convenient, short and yet allows for customization. Here is an example of how this could be done (from my prototype):

#define HOMEKIT_SERVICE(iid_, name, ...) \
    { DEFINE_HOMEKIT_SERVICE_ ## name, .iid = iid_, ## __VA_ARGS__ }

#define HOMEKIT_CONCAT3(a, b, c) HOMEKIT_CONCAT3_(a, b, c)
#define HOMEKIT_CONCAT3_(a, b, c) a ## b ## c
#define HOMEKIT_CHARACTERISTIC_TYPE(name) HOMEKIT_CONCAT3(HAP, TYPEOF_HOMEKIT_CHARACTERISTIC_ ## name, Characteristic)

#define HOMEKIT_CHARACTERISTIC_(iid_, name, ...) \
    { DEFINE_HOMEKIT_CHARACTERISTIC_ ## name, .iid = iid_, ## __VA_ARGS__ }

#define HOMEKIT_CHARACTERISTIC(iid_, name, ...) \
    &(HOMEKIT_CHARACTERISTIC_TYPE(name)) HOMEKIT_CHARACTERISTIC_(iid_, name, ## __VA_ARGS__)


#define DEFINE_HOMEKIT_SERVICE_ACCESSORY_INFORMATION \
    .serviceType = &kHAPServiceType_AccessoryInformation, \
    .debugDescription = kHAPServiceDebugDescription_AccessoryInformation \

#define TYPEOF_HOMEKIT_CHARACTERISTIC_MANUFACTURER String
#define DEFINE_HOMEKIT_CHARACTERISTIC_MANUFACTURER \
    .format = kHAPCharacteristicFormat_String, \
    .characteristicType = &kHAPCharacteristicType_Manufacturer, \
    .debugDescription = kHAPCharacteristicDebugDescription_Manufacturer, \
    .properties = { \
        .readable = true, \
    }, \
    .constraints = { .maxLength = 64 }, \
    .callbacks = { .handleRead = HAPHandleAccessoryInformationManufacturerRead, }


const HAPService accessoryInformationService = HOMEKIT_SERVICE(0x01, ACCESSORY_INFORMATION,
    .characteristics = (const HAPCharacteristic* const[]) {
        HOMEKIT_CHARACTERISTIC(0x02, IDENTIFY),
        HOMEKIT_CHARACTERISTIC(0x03, MANUFACTURER),
        HOMEKIT_CHARACTERISTIC(0x04, MODEL),
        HOMEKIT_CHARACTERISTIC(0x05, ACCESSORY_NAME),
        HOMEKIT_CHARACTERISTIC(0x06, SERIAL_NUMBER),
        HOMEKIT_CHARACTERISTIC(0x07, FIRMWARE_REVISION),
        HOMEKIT_CHARACTERISTIC(0x08, HARDWARE_REVISION),
        HOMEKIT_CHARACTERISTIC(0x09, ADK_VERSION),
        NULL
    },
);

Here is example of more interesting service - a fan:

const HAPUInt8Characteristic fanActiveCharacteristic =
    HOMEKIT_CHARACTERISTIC_(0x42, ACTIVE,
        .callbacks.handleRead=HandleFanActiveRead,
        .callbacks.handleWrite=HandleFanActiveWrite,
    );

const HAPFloatCharacteristic fanRotationSpeedCharacteristic =
    HOMEKIT_CHARACTERISTIC_(0x43, ROTATION_SPEED,
        .callbacks.handleRead=HandleFanRotationSpeedRead,
        .callbacks.handleWrite=HandleFanRotationSpeedWrite,
    );

const HAPUInt8Characteristic fanSwingModeCharaceristic =
    HOMEKIT_CHARACTERISTIC_(0x44, SWING_MODE,
        .callbacks.handleRead=HandleFanSwingModeRead,
        .callbacks.handleWrite=HandleFanSwingModeWrite,
    );

const HAPService fanService = HOMEKIT_SERVICE(0x40, FAN,
    .name = "Fan",
    .characteristics = (const HAPCharacteristic* const[]) {
        HOMEKIT_CHARACTERISTIC(0x41, NAME),
        &fanActiveCharacteristic,
        &fanRotationSpeedCharacteristic,
        &fanSwingModeCharacteristic,
        NULL
    },
);

The above could be defined with all characteristics in-place right inside service declaration, but I think sometimes you need to raise an event on some characteristic outside it's read/write handler, so thus you need to have a pointer/reference to it.

So, ADK could have a library of field definitions for standard Apple services / characteristics. Plus, it is easy to create your own (just need to declare a bunch of defines).

Characteristic value notifications via Subscription

Hi folks,

I am looking for clarifications on how a device should push new values for a characteristic when it changes at the node, so Homekit reflects the current state of the device. That is, if I have a switch that is physically flicked on or off, how do I push this change out to Homekit?

I can see how subscriptions callbacks are wired to handleSubscribe and handleUnsubscribe, for example:

const HAPBoolCharacteristic switchOnCharacteristic = {
    .format = kHAPCharacteristicFormat_Bool,
    .iid = kIID_SwitchOn,
    ...
    ...
    ...
    .callbacks = { .handleRead = HandleSwitchOnRead, .handleWrite = HandleSwitchOnWrite,
                   .handleSubscribe=HandleSwitchOnSubscribe, .handleUnsubscribe=HandleSwitchOnUnsubscribe,}
};

I can receive subscriptions/un-subscriptions requests fine and assume this is the mechanism by which change notifications can be pushed from the device's end. The subscription callback receives a HAPBoolCharacteristicSubscriptionRequest pointer, but how can I update the actual value of the characteristic later?

I am most certainly missing something obvious, thanks for any pointers.

Running Lightbulb application,got DNSServiceRegister failed:

I had build the the applications in Ubuntu 18.04 TLS, then run Lightbulb.OpenSSL application, then got the error message.

2020-06-09'T'06:28:51'Z' Error [com.apple.mfi.HomeKit.Platform:ServiceDiscovery] HAPPlatformServiceDiscoveryRegister: DNSServiceRegister failed: -65537.
2020-06-09'T'06:28:51'Z' Fault fatal error - HAPPlatformServiceDiscoveryRegister @ PAL/Linux/HAPPlatformServiceDiscovery.c:150

How can I fix it?

Not really an issue. iOS 14

Hi, since public iOS 14 version release I detect some strange behaivour in accessories (some of them). Some of then become "No answer" after working for years, and I can't say why.
This is started from my home automation center (appletv) being updated to iOS 14. Same time, enabling the home automation center on other device iOS12 or iOS13 (i have both) making the accessories to work again.
Offcourse I am talking about self-made (not certified) devices.
Is there any major changes in HAP or the way its implemented in iOS 14 we need to know to understand what happened?
Thanks in advance.

Accessories added through the bridge cannot display the correct name

Accessories added through the bridge cannot display the correct name

Through the bridge to add accessories, reference link "How to implement a bridge"

This is my code

static HAPAccessory bridgeAccessory = { .aid = 1,
                                        .category = kHAPAccessoryCategory_Bridges,
                                        .name = "SNB Bridge",
                                        .manufacturer = "SNB",
                                        .model = "Bridge1,1",
                                        .serialNumber = "ABCDEFGH0001",
                                        .firmwareVersion = "1",
                                        .hardwareVersion = "1",
                                        .services = (const HAPService* const[]) { &accessoryInformationService,
                                                                                  &hapProtocolInformationService,
                                                                                  &pairingService,
                                                                                  NULL },
                                        .callbacks = { .identify = IdentifyAccessory } };
static HAPAccessory accessory = { .aid = 2,
                                  //.category = kHAPAccessoryCategory_Lighting,
                                  .category = kHAPAccessoryCategory_BridgedAccessory,
                                  .name = "Acme Light",
                                  .manufacturer = "Acme",
                                  .model = "LightBulb1,1",
                                  .serialNumber = "099DB48E9E28",
                                  .firmwareVersion = "1",
                                  .hardwareVersion = "1",
                                  .services = (const HAPService* const[]) { &accessoryInformationService,
                                                                            &hapProtocolInformationService,
                                                                            &pairingService,
                                                                            &lightBulbService,
                                                                            NULL },
                                  .callbacks = { .identify = IdentifyAccessory } };
const HAPAccessory* _Nullable const* _Nullable bridgedAccessories =
    (const HAPAccessory* const[]) { &accessory,
                                    NULL };

void AppAccessoryServerStart(void) {
    HAPAccessoryServerStartBridge(
        accessoryConfiguration.server, &bridgeAccessory,
        bridgedAccessories, true
    );
}

Successfully added accessories in the home, the name shows "Light Bulb", but what I expect is "Acme Light".
Thanks!

Support for nRF52

Hi!

I saw that on one of the last updates there is new TARGET on documentation nRF52. I have question that anybody know that support for this microcontrollers has actually be added or this is some kind of mistake?

I have tried to compile it with this target but without success.

Sending build context to Docker daemon 2.048kB Step 1/3 : FROM ubuntu:18.04 ---> 4e5021d210f6 Step 2/3 : RUN echo ========== Install dependencies ========== && apt-get update && apt-get install -y clang gdb git libavahi-compat-libdnssd-dev libssl-dev make openssh-server perl unzip wget && apt-get clean && rm -rf /var/lib/apt/lists/* ---> Using cache ---> 7f623943446c Step 3/3 : WORKDIR /build ---> Using cache ---> 5f555e6c81e6 Successfully built 5f555e6c81e6 make: *** No rule to make target 'Output/nRF52-/Test/Tests/HAPBLEEventTest.', needed by 'tests'. Stop. make: *** [all] Error 2

What is the purpose of the Docker images?

Hi,

I am trying to wrap my mind around the purpose of the Docker image(s). The nginx image builds and runs just fine, but it doesn't have any network adapters configured, so how are the examples supposed to run?

And re. the raspi image: When I run docker build -f Dockerfile.Raspi -t raspi_image . in an attempt to create a pi image I get the error below. Not sure if that is expected.

Sending build context to Docker daemon  3.072kB
Step 1/3 : FROM dev-test/raspiadk-base as build
pull access denied for dev-test/raspiadk-base, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

I am probably still missing something but I can't find anything in the available doc to help me out.

Please advice.

Kind Regards,

Erwin

Compile Error

Hi all,

I am getting a compile error for yocto build:

clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1 -ffunction-sections -fdata-sections -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=3 -DHAP_TESTING -IPAL/Linux -IPAL/Linux -DHAP_Debug -c PAL/Linux/HAPPlatformRandomNumber.c -o Output/Linux-x86_64-unknown-linux-gnu/Debug/PAL/Linux/HAPPlatformRandomNumber.o
PAL/Linux/HAPPlatformRandomNumber.c:48:44: error: use of undeclared identifier 'GRND_NONBLOCK'
const int getrandomFlags = GRND_NONBLOCK; // Use the urandom source and do not block.
^
PAL/Linux/HAPPlatformRandomNumber.c:52:29: error: use of undeclared identifier 'SYS_getrandom'
n = syscall(SYS_getrandom, &((uint8_t*) bytes)[o], c, getrandomFlags);
^
2 errors generated.
make[1]: *** [Output/Linux-x86_64-unknown-linux-gnu/Debug/PAL/Linux/HAPPlatformRandomNumber.o] Error 1

I defined dependencies as "clang openssl avahi". I am using following command to build:
make TARGET=Linux DOCKER=0 PROTOCOLS=IP apps

What could be the problem?

Setup code for Lightbulb and Lock

Hello, could you please explain how the 8-digit key is generated and what's the key for pairing the Lightbulb and Lock Application examples?

I've been trying to pair the accessory for a while but with no effect.
App quits due to:

2019-12-28'T'23:08:00'Z' Error [com.apple.mfi.HomeKit.Platform:AccessorySetup] No setup code found in key-value store.

Meanwhile I noticed that some files in .HomeKitStore are read, especially .HomeKitStore/40.10 which not exist, so I made a try in creation this file filled with 400 bytes (I get the value from the code). Now it does not quit, it's waiting for the 8-digit key but I don't have even an idea what it could be...

Could you please help with that? I'm running Linux build. Thanks in advance.

No setup code found in key-value store.

I compile and run example under Ubuntu 20.04

make tools
sudo ./Tools/provision_raspi.sh --category 5 --setup-code 111-22-333 ./Output/Linux-x86_64-pc-linux-gnu/Debug/IP/Applications/.HomeKitStore
make TARGET=Linux apps
./Output/Linux-x86_64-pc-linux-gnu/Debug/IP/Applications/Lightbulb.OpenSSL

So, in the first terminal I see QR code, in the second - LightBulb logs, when I scan this QR code with Add accessory and push "Add Anyway" on a modal with "Uncertified Accessory" I get

2021-02-24'T'13:17:53'Z'	Error	[com.apple.mfi.HomeKit.Platform:AccessorySetup] No setup code found in key-value store.
2021-02-24'T'13:17:53'Z'	Fault	fatal error - HAPPlatformAccessorySetupLoadSetupInfo @ PAL/Linux/HAPPlatformAccessorySetup.c:50

In the .HomeKitStore directory I see two files 40.10 & 40.11

UPD: The solution is to put .HomeKitStore to the root dir

Generating an Accessory

Greetings, I am looking for a way to generate a custom HomeKit accessory based on the example provided in the Applications folder -- Lightbulb and Lock. Was HomeKit Accessory manager used to generate these files or were they coded up by hand? Can I use .hasaccessory file to generate those 5 files from examples? Thank you

Segmentation fault while adding an accessory

I'm implementing a bridge and encounter with segmentation fault during adding it using HomeKit app:

  • target platform: MIPS32
  • compiler: musl GCC v7.3.0

It looks like HomeKit Core tries to access wrong memory address just before reading the characteristics of the bridge.

This is the debug message:

./Bridge.MbedTLS 
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:KeyValueStore] Storage configuration: keyValueStore = 4
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:AccessorySetup] Storage configuration: accessorySetup = 4
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:TCPStreamManager] Storage configuration: tcpStreamManager = 72
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:TCPStreamManager] Storage configuration: maxTCPStreams = 17
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:TCPStreamManager] Storage configuration: tcpStreams = 408
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:ServiceDiscovery] Storage configuration: serviceDiscovery = 552
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] HAPPlatformMFiHWAuthCreate
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] Storage configuration: mfiHWAuth = 8
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:RunLoop] Storage configuration: runLoop = 320
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:RunLoop] Storage configuration: fileHandle = 28
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:RunLoop] Storage configuration: timer = 24
2020-03-21'T'01:00:21'Z'	Default	[com.apple.mfi.HomeKit.Core:AccessoryServer] Version information:
libhap: OpenWrt-mipsel-openwrt-1-musl
  - Version: 4.0 (e9d7913) - compatibility version 8
  - Extensions:
    - Key Export
    - HomeKit Data Stream (TCP)
Using platform: Linux
  - Version: 4.14.81 (Mar 23 2020 12:33:22) - compatibility version 8
  - Available features:
    - Key-Value store
    - Accessory setup manager
    - TCP stream manager
    - Service discovery
    - Apple Authentication Coprocessor provider
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Core:AccessoryServer] Storage configuration: server = 2152
2020-03-21'T'01:00:21'Z'	Info	[com.apple.mfi.HomeKit.Core:MFiHWAuth] Turning on Apple Authentication Coprocessor.
2020-03-21'T'01:00:21'Z'	Default	[com.apple.mfi.HomeKit.Platform:Clock] Using 'clock_gettime' with 'CLOCK_MONOTONIC_RAW'.
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x05.
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x00.
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x01.
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x02.
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x03.
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x05.
2020-03-21'T'01:00:21'Z'	Default	[com.apple.mfi.HomeKit.Core:MFiHWAuth] Apple Authentication Coprocessor information:
- Device Version: 3.0 (0x07)
- Authentication Revision: 1
- Authentication Protocol Version: 3.0
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x40.
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Storage configuration: ipAccessoryServerStorage = 32
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Storage configuration: numSessions = 17
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Storage configuration: sessions = 14688
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Storage configuration: sessions[0...16].inboundBuffer.numBytes = 32768
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Storage configuration: sessions[0...16].outboundBuffer.numBytes = 32768
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Storage configuration: sessions[0...16].numEventNotifications = 258
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Storage configuration: sessions[0...16].eventNotifications = 6192
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Storage configuration: numReadContexts = 258
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Storage configuration: readContexts = 12384
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Storage configuration: numWriteContexts = 258
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Storage configuration: writeContexts = 16512
2020-03-21'T'01:00:21'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Storage configuration: scratchBuffer.numBytes = 32768
2020-03-21'T'01:00:22'Z'	Info	AppCreate
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Core:AccessoryServer] Checking accessory definition. If this crashes, verify that accessory, service and characteristic lists are properly NULL-terminated.
2020-03-21'T'01:00:22'Z'	Default	[com.apple.mfi.HomeKit.Core:AccessoryValidation] [0000000000000001 AXIS Smart Bridge] An accessory should advertise one of its services as its primary service.
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Core:AccessoryServer] Accessory definition ok.
2020-03-21'T'01:00:22'Z'	Info	[com.apple.mfi.HomeKit.Core:AccessoryServer] Accessory server starting.
2020-03-21'T'01:00:22'Z'	Info	[com.apple.mfi.HomeKit.Core:AccessoryServer] Firmware version: 1.1.0
2020-03-21'T'01:00:22'Z'	Info	[com.apple.mfi.HomeKit.Core:AccessoryServer] [1.1.0] Storing initial firmware version.
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Core:AccessoryServer] Registering accessories.
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Core:AccessoryServer] Loading accessory identity.
2020-03-21'T'01:00:22'Z'	Info	[com.apple.mfi.HomeKit.Core:AccessoryServer] <private> Generated new LTSK.
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Core:AccessoryServer] Checking if admin pairing exists.
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Core:AccessorySetupInfo] HAPAccessorySetupInfoHandleAccessoryServerStart
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Starting server engine.
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Platform:TCPStreamManager] TCP stream listener interface index: 0
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Platform:TCPStreamManager] TCP stream listener port: 45399.
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Platform:TCPStreamManager] listen(7, 64);
2020-03-21'T'01:00:22'Z'	Info	[com.apple.mfi.HomeKit.Core:IPServiceDiscovery] Not incrementing IP GSN because accessory server is not paired.
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x05.
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x00.
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x01.
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x02.
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x03.
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x05.
2020-03-21'T'01:00:22'Z'	Default	[com.apple.mfi.HomeKit.Core:MFiHWAuth] Apple Authentication Coprocessor information:
- Device Version: 3.0 (0x07)
- Authentication Revision: 1
- Authentication Protocol Version: 3.0
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x40.
2020-03-21'T'01:00:22'Z'	Info	[com.apple.mfi.HomeKit.Core:IPServiceDiscovery] Registering _hap._tcp service.
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Platform:ServiceDiscovery] interfaceIndex: 0
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Platform:ServiceDiscovery] name: "AXIS Smart Bridge"
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Platform:ServiceDiscovery] protocol: "_hap._tcp"
2020-03-21'T'01:00:22'Z'	Debug	[com.apple.mfi.HomeKit.Platform:ServiceDiscovery] port: 45399
2020-03-21'T'01:00:22'Z'	Info	[com.apple.mfi.HomeKit.Platform:RunLoop] Entering run loop.
2020-03-21'T'01:00:22'Z'	Info	Accessory Server State did update: Running.
2020-03-21'T'01:00:24'Z'	Debug	[com.apple.mfi.HomeKit.Core:AccessoryServer] [0000000000000003 Living Room East] [0000000000000033 position.target] Marking characteristic as modified.
2020-03-21'T'01:00:24'Z'	Info	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Raising an event while in disconnected state.
2020-03-21'T'01:00:24'Z'	Default	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Not re-publishing HomeKit service because accessory server is not paired.
2020-03-21'T'01:00:24'Z'	Info	CheckGearsDB: reporting target position 50
2020-03-21'T'01:00:24'Z'	Debug	[com.apple.mfi.HomeKit.Core:AccessoryServer] [0000000000000005 Living Room West] [0000000000000033 position.target] Marking characteristic as modified.
2020-03-21'T'01:00:24'Z'	Info	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Raising an event while in disconnected state.
2020-03-21'T'01:00:24'Z'	Default	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Not re-publishing HomeKit service because accessory server is not paired.
2020-03-21'T'01:00:24'Z'	Info	CheckGearsDB: reporting target position 95
2020-03-21'T'01:00:24'Z'	Debug	[com.apple.mfi.HomeKit.Core:AccessoryServer] [0000000000000006 First Bedroom North] [0000000000000033 position.target] Marking characteristic as modified.
2020-03-21'T'01:00:24'Z'	Info	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Raising an event while in disconnected state.
2020-03-21'T'01:00:24'Z'	Default	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Not re-publishing HomeKit service because accessory server is not paired.
2020-03-21'T'01:00:24'Z'	Info	CheckGearsDB: reporting target position 50
2020-03-21'T'01:00:24'Z'	Debug	[com.apple.mfi.HomeKit.Core:AccessoryServer] [0000000000000007 Second Bedroom West] [0000000000000033 position.target] Marking characteristic as modified.
2020-03-21'T'01:00:24'Z'	Info	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Raising an event while in disconnected state.
2020-03-21'T'01:00:24'Z'	Default	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Not re-publishing HomeKit service because accessory server is not paired.
2020-03-21'T'01:00:24'Z'	Info	CheckGearsDB: reporting target position 50
2020-03-21'T'01:00:24'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x02.
2020-03-21'T'01:00:24'Z'	Info	[com.apple.mfi.HomeKit.Core:MFiHWAuth] Turning off Apple Authentication Coprocessor.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Platform:TCPStreamManager] accept(7, NULL, NULL);
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Opening HAP session.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Core:Session] HAPSessionCreate
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Starting TCP progression timer.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] session:0x60d5b8:accepted
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Core:AccessorySetupInfo] Pairing attempt started.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] Pair Setup M1: SRP Start Request.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] Pair Setup M1: kTLVType_Method = 1.
2020-03-21'T'01:00:33'Z'	Info	[com.apple.mfi.HomeKit.Core:MFiHWAuth] Turning on Apple Authentication Coprocessor.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x05.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x00.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x01.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x02.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x03.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x05.
2020-03-21'T'01:00:33'Z'	Default	[com.apple.mfi.HomeKit.Core:MFiHWAuth] Apple Authentication Coprocessor information:
- Device Version: 3.0 (0x07)
- Authentication Revision: 1
- Authentication Protocol Version: 3.0
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x40.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] Pair Setup M2: SRP Start Response.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] Pair Setup M2: Processing using kPairingFlag_Transient = false / kPairingFlag_Split = false.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Core:AccessorySetupInfo] Loading static setup code.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M2: verifier.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M2: b.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] Pair Setup M3: SRP Verify Request.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] Pair Setup M4: SRP Verify Response.
2020-03-21'T'01:00:33'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M4: u.
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M4: S.
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M4: K.
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M4: M1
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M4: SessionKey
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x05.
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x00.
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x01.
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x02.
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x03.
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x05.
2020-03-21'T'01:00:34'Z'	Default	[com.apple.mfi.HomeKit.Core:MFiHWAuth] Apple Authentication Coprocessor information:
- Device Version: 3.0 (0x07)
- Authentication Revision: 1
- Authentication Protocol Version: 3.0
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x40.
2020-03-21'T'01:00:34'Z'	Info	[com.apple.mfi.HomeKit.Core:PairingPairSetup] Using Apple Authentication Coprocessor.
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M4: MFiChallenge.
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x05.
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x02.
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi write complete.
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi write complete.
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x10.
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x11.
2020-03-21'T'01:00:34'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x12.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x05.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M4: kTLVType_Signature.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x05.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x02.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x30.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x31.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x32.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x33.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x34.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x35.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x05.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M4: kTLVType_Certificate.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M4: kTLVType_ProductData.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] Pair Setup M5: Exchange Request.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M5: kTLVType_EncryptedData (decrypted).
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M5: iOSDeviceInfo.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M5: kTLVType_Signature.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] Pair Setup M6: Exchange Response.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M6: ed_LTSK.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M6: ed_LTPK.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M6: AccessoryDeviceInfo.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairSetup] <private> Pair Setup M6: kTLVType_Signature.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:AccessorySetupInfo] Pairing attempt completed.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:AccessorySetupInfo] Invalidating setup code.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x05.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x00.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x01.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x02.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x03.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x05.
2020-03-21'T'01:00:35'Z'	Default	[com.apple.mfi.HomeKit.Core:MFiHWAuth] Apple Authentication Coprocessor information:
- Device Version: 3.0 (0x07)
- Authentication Revision: 1
- Authentication Protocol Version: 3.0
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x40.
2020-03-21'T'01:00:35'Z'	Info	[com.apple.mfi.HomeKit.Core:IPServiceDiscovery] Updating _hap._tcp service.
2020-03-21'T'01:00:35'Z'	Info	Accessory Server State did update: Running.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] session:0x60d5b8:input closed
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] session:0x60d5b8:closing
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] session:0x60d5b8:closing security context
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Closing HAP session.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:Session] HAPSessionRelease
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:Session] HAPSessionInvalidate
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] session:0x60d5b8:closing TCP stream
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:TCPStreamManager] shutdown(9, SHUT_RDWR);
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Platform:TCPStreamManager] close(9);
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] session:0x60d5b8:closed
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] session:0x60d5b8:releasing session
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] session:0x60d5b8: session released
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Attempting to send event notifications.
2020-03-21'T'01:00:35'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Stopping TCP progression timer.
2020-03-21'T'01:00:36'Z'	Debug	[com.apple.mfi.HomeKit.Platform:MFiHWAuth] MFi read 0x02.
2020-03-21'T'01:00:36'Z'	Info	[com.apple.mfi.HomeKit.Core:MFiHWAuth] Turning off Apple Authentication Coprocessor.
2020-03-21'T'01:00:36'Z'	Debug	[com.apple.mfi.HomeKit.Platform:TCPStreamManager] accept(7, NULL, NULL);
2020-03-21'T'01:00:36'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Opening HAP session.
2020-03-21'T'01:00:36'Z'	Debug	[com.apple.mfi.HomeKit.Core:Session] HAPSessionCreate
2020-03-21'T'01:00:36'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Starting TCP progression timer.
2020-03-21'T'01:00:36'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] session:0x60d5b8:accepted
2020-03-21'T'01:00:36'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairVerify] Pair Verify M1: Verify Start Request.
2020-03-21'T'01:00:36'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairVerify] Pair Verify M1: kTLVType_Method = 2.
2020-03-21'T'01:00:36'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairVerify] Pair Verify M2: Verify Start Response.
2020-03-21'T'01:00:36'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairVerify] <private> Pair Verify M2: cv_SK.
2020-03-21'T'01:00:37'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairVerify] <private> Pair Verify M2: cv_KEY.
2020-03-21'T'01:00:37'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairVerify] <private> Pair Verify M2: AccessoryInfo
2020-03-21'T'01:00:37'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairVerify] <private> Pair Verify M2: kTLVType_Signature
2020-03-21'T'01:00:37'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairVerify] <private> Pair Verify M2: SessionKey
2020-03-21'T'01:00:37'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairVerify] Pair Verify M3: Verify Finish Request.
2020-03-21'T'01:00:37'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairVerify] <private> Pair Verify M3: iOSDeviceInfo.
2020-03-21'T'01:00:37'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairVerify] <private> Pair Verify M3: kTLVType_Signature.
2020-03-21'T'01:00:37'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairVerify] Pair Verify M4: Verify Finish Response.
2020-03-21'T'01:00:37'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairVerify] <private> Pair Verify Start Session: AccessoryToControllerKey
2020-03-21'T'01:00:37'Z'	Debug	[com.apple.mfi.HomeKit.Core:PairingPairVerify] <private> Pair Verify Start Session: ControllerToAccessoryKey
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:PairingPairVerify] Pair Verify procedure completed (pairing ID 0).
2020-03-21'T'01:00:37'Z'	Debug	[com.apple.mfi.HomeKit.Core:IPAccessoryServer] Established HAP security session.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characterist[13393.384848] do_page_fault(): sending SIGSEGV to Bridge.MbedTLS for invalid read access from 00000002
ic] [00000000000[13393.394757] epc = 00000003 in Bridge.MbedTLS[400000+175000]
00001 AXIS Smart[13393.401792] ra  = 0040fc80 in Bridge.MbedTLS[400000+175000]
 Bridge] [0000000000000003 manufacturer] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000001 AXIS Smart Bridge] [0000000000000004 model] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000001 AXIS Smart Bridge] [0000000000000005 name] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000001 AXIS Smart Bridge] [0000000000000006 serial-number] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000001 AXIS Smart Bridge] [0000000000000007 firmware.revision] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000001 AXIS Smart Bridge] [0000000000000008 hardware.revision] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000001 AXIS Smart Bridge] [0000000000000009 adk-version] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000001 AXIS Smart Bridge] [000000000000000A product-data] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000001 AXIS Smart Bridge] [0000000000000012 version] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000003 Living Room East] [0000000000000003 manufacturer] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000003 Living Room East] [0000000000000004 model] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000003 Living Room East] [0000000000000005 name] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000003 Living Room East] [0000000000000006 serial-number] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000003 Living Room East] [0000000000000007 firmware.revision] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000003 Living Room East] [0000000000000008 hardware.revision] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000003 Living Room East] [0000000000000009 adk-version] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000003 Living Room East] [000000000000000A product-data] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000003 Living Room East] [0000000000000032 name] Calling read handler.
2020-03-21'T'01:00:37'Z'	Info	[com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000003 Living Room East] [0000000000000033 position.target] Calling read handler.
Segmentation fault

Any clue or suggestion would be appreciated.

Compilation error : Plain linux for testing

Context

I am trying to compile the kit on a plain linux (Kubutnu 19.10 or WSL Ubuntu 18.04). This post and the following comments describe the errors I get in the process and what I am trying to do to fix them.

Errors

When simply cloning and building the kit w/ make on a Linux system (Ubuntu WSL or Kubuntu 19.10), I get a compilation error on the following step :

clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1  -ffunction-sections -fdata-sections -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=3     
-DHAP_TESTING -IPAL/Linux -IPAL/Linux   -DHAP_Debug -c HAP/HAPRequestHandlers+Pairing.c -o Output/Linux-x86_64-pc-linux-gnu/Debug/HAP/HAPRequestHandlers+Pairing.o

The error is the following :

Applications/Lock/Main.c:1:1: error: expected identifier or '('
../Main.c
^
1 error generated.
Build/Makefile:162: recipe for target 'Output/Linux-x86_64-pc-linux-gnu/Debug/IP/Applications/Lock/Main.o' failed

The contents of the related file, Applications/Lock/Main.c, are the most peculiar :

../Main.c

There is indeed a Main.c in the parent directory of the file, that seems "normal".

Why not respond to the m1 chip? | 왜 m1칩에 대응을 하지 않는가?

I was really absurd. Even though I was developing on a Mac, the latest computer was only an emulator, that is, docker or vmware is not running.
---------english-------------------------------------
난 정말 어이없었다 난 맥으로 개발을 하는데도 단지 제일 최신컴퓨터가 에뮬레이터 즉 도커나 vmware가 구동되지 않아서 맥에서 멕전용 게발툴로 맥전용 api를 가지고 애플 홈 api를 사용할수 없는건가 why?
---------korean-------------------------------------

Add a context pointer to HAPAccessory, HAPService and and HAPCharacteristic

Currently characteristic callbacks get server-wide context and a pointer to characteristic (via request).
This presents a problem when a mechanism is required to map instances of HAPCharacteristic to some other entity (in my case, a C++ wrapper class). A separate list of instances is required, with lookup to find the right one.
Same applies to HAPService and HAPAccessory - wrappers need to keep track of their instances separately.
Would it be possible to add a void *context pointer to each of these structs, so finer-grained context can be attached to them?

Doxygen documentation ?

Do we want/need a Doxygen documentation generation for this project ? Wouldn't it be a good idea to have one ? There are already lots of documentation comments in the code that could be used by Doxygen.

ADK/Tools/provisionraspi.sh

Related to the HomeKit ADK available on Github,
even though the "HomeKit ADK Integration Guide - for ADK 5.1.pdf" references the ADK/Tools/provisionraspi.sh, the script does not exist.

Does anyone know why the ADK/Tools/provisionraspi.sh is not available in Apple MFI HomeKit ADK 5.1. zip, but it is available in the Github HK ADK? It looks like the Github script does not have the same format as documented in the "HomeKit ADK Integration Guide - for ADK 5.1.pdf".

DNS Service Discovery

Developing accessories for ESP8266/ESP32 I have faced a problem with DNS SD. Accessories goes offline and back online from time to time.
When this happen during the Pairing Setup - accessory become paired, and controller does not even know it, because it already closed the pairing context (due to DNS SD monitoring)
Investigating the problem I have traced all the MDNS packets and made a conclusion, the UDP packets drop cause this. Slow WiFI interfaces cant handle all the UDP milticast packets from the local network. And the bigger accessories give more UDP traffic and more drops.
This is normal to UDP - because there is no confirmation of packet receiving. And thats why DNS SD standart was designed that way, every packet has time to live (TTL) value. In our case its 120 sec for PTR record. This means, last received packet should be considered as "true" diring this TTL period. So in case an accessory (commonly low power weak device) will miss some request, it has 120 seconds to remain present.
But on practice we have other behaivour. The controller may recognize accessory goes offline even after few requests being missed. For speed LAN devices this is more or less OK situation, but not for WiFi for sure.
The only current workaround I see is to constantly keep the accessory advertising itself to fit the most of MDNS queries from controller (at least during pairing process).
But I understand this is not the way it should be done. Any sugestions welcome.
Thanks and sorry for long reading.

Docker build necessary ?

Why exactly do we need to run make in a docker container. Of course I understand the benefits of doing so, but shouldn't it be an option when running make for the first time ? Something like make DOCKER_BUILD=y or so ?

Build on Raspberry Pi without Docker

Hi!

I have tried to do the sd card setup script on my mac but I have run into so many issues at this point. I have a Raspberry Pi set up as a dev machine. Just to get going I was thinking I could probably build the ADK on my Raspberry Pi. The issue is that the make file seems to require the docker setup to be completed. Is there any way that I can bypass the Docker step and just compile the ADK on my Raspberry Pi?

Linker errors and general understanding of build process

I am trying to use HomeKit ADK on MacOS Catalina. I want to compile for MacOS (just to get startet) and cross-compile for RaspberryPi.

After building and reading the docs and installing the prerequisites using "brew", I understand that a simple "make all" should perform the macos build. But it fails with HAP related linker errors (such as "Undefined symbols for architecture x86_64: "_HAPAccessorySetupGetSetupHash", referenced from: _Test in HAPAccessorySetupGetSetupHashTest.o". Any suggestions?

Furthermore, I am totally lost as to how the docker-related cross-compilation for RaspberryPi is supposed to be carried out, and I would appreciate some more detailed instructions for the purpose.

Invalid docker reference & Fork bomb with make

Setup :

  • Ubuntu 19.10
  • Docker version 19.03.3, build a872fc2f86
  • GNU Make 4.2.1
  • Commit SHA: bb0c614

Issues

1) make TARGET=Linux all

  • Result :
$ make TARGET=Linux allSending build context to Docker daemon     30MB
Step 1/5 : FROM ubuntu:18.04
 ---> 549b9b86cb8d
Step 2/5 : RUN echo ========== Install dependencies ==========   && apt-get update && apt-get install -y     clang     git     make     perl     python3-pip     unzip     wget     libasound2-dev     libavahi-compat-libdnssd-dev     libfaac-dev     libopus-dev     libsqlite3-dev     libssl-dev
 ---> Using cache
 ---> e65f030d9088
Step 3/5 : RUN apt-get install -y gdb
 ---> Using cache
 ---> 95ec9292ed42
Step 4/5 : RUN echo ========== Cleanup ==========   && rm -rf /var/lib/apt/lists/*
 ---> Using cache
 ---> 4e94fb11151c
Step 5/5 : WORKDIR /build
 ---> Using cache
 ---> eab9b00d43fe
Successfully built eab9b00d43fe
docker: invalid reference format.
See 'docker run --help'.
make: *** [Makefile:55: all] Error 125

I have narrowed it down to the main Makefile. The RUN definition must not be getting a correct

2) make TARGET=Linux docker

This seems to work correctly :

Sending build context to Docker daemon     30MB
Step 1/5 : FROM ubuntu:18.04
 ---> 549b9b86cb8d
Step 2/5 : RUN echo ========== Install dependencies ==========   && apt-get update && apt-get install -y     clang     git     make     perl     python3-pip     unzip     wget     libasound2-dev     libavahi-compat-libdnssd-dev     libfaac-dev     libopus-dev     libsqlite3-dev     libssl-dev
 ---> Using cache
 ---> e65f030d9088
Step 3/5 : RUN apt-get install -y gdb
 ---> Using cache
 ---> 95ec9292ed42
Step 4/5 : RUN echo ========== Cleanup ==========   && rm -rf /var/lib/apt/lists/*
 ---> Using cache
 ---> 4e94fb11151c
Step 5/5 : WORKDIR /build
 ---> Using cache
 ---> eab9b00d43fe
Successfully built eab9b00d43fe
eab9b00d43fe

We do get the docker contained ID at the end. This is what needs to be inserted in the docker run command.

Analysis

The

-it `make docker`

line does not have a correct syntax. And does not give the Makefile's command the argument it should.

What was attempted

Replacing

-it `make docker`

by

-it $(shell make docker)

This results in a fork bomb.

make: Makefile:5: fork: Resource temporarily unavailable
make: Makefile:11: fork: Resource temporarily unavailable
make: Makefile:28: fork: Resource temporarily unavailable
make: fork: Resource temporarily unavailable
/bin/sh: 0: Cannot fork
make: *** [Makefile:61: docker] Error 2
/bin/sh: 0: Cannot fork
make: *** [Makefile:61: docker] Error 2
/bin/sh: 0: Cannot fork
make: *** [Makefile:61: docker] Error 2
/bin/sh: 0: Cannot fork
make: *** [Makefile:61: docker] Error 2
/bin/sh: 0: Cannot fork
make: *** [Makefile:61: docker] Error 2
make: fork: Resource temporarily unavailable
...

How to implement a bridge

Hi,

I'm trying a to implement a simple bridge including a bridged light bulb accessory. I basically added two accessories and used HAPAccessoryServerStartBridge instead of HAPAccessoryServerStart like in the following snippets. The bridge accessory works as expected, I successfully added it in the Apple Home app. Unfortunately the light bulb does not show up in the app. Instead it says "Additional Setup Required", "Add related accessories with Acme Bridge in the manufacturers app." Does a bridge really need a separate app to add accessories or is the issue somewhere else?

static HAPAccessory bridgeAccessory = { .aid = 1,
                                        .category = kHAPAccessoryCategory_Bridges,
                                        .name = "Acme Bridge",
                                        .manufacturer = "Acme",
                                        .model = "Bridge1,1",
                                        .serialNumber = "ABCDEFGH0001",
                                        .firmwareVersion = "1",
                                        .hardwareVersion = "1",
                                        .services = (const HAPService* const[]) { &bridgeAccessoryInformationService,
                                                                                  &hapProtocolInformationService,
                                                                                  &pairingService,
                                                                                  NULL },
                                        .callbacks = { .identify = IdentifyAccessory } };

static HAPAccessory lightBulbAccessory = { .aid = 2,
                                           .category = kHAPAccessoryCategory_BridgedAccessory,
                                           .name = "Acme Light Bulb",
                                           .manufacturer = "Acme",
                                           .model = "LightBulb1,1",
                                           .serialNumber = "ABCDEFGH0002",
                                           .firmwareVersion = "1",
                                           .hardwareVersion = "1",
                                           .services = (const HAPService* const[]) { &lightBulbAccessoryInformationService,
                                                                                     &lightBulbService,
                                                                                     NULL },
                                           .callbacks = { .identify = IdentifyAccessory } };
void AppAccessoryServerStart(void) {
    HAPAccessoryServerStartBridge(
        accessoryConfiguration.server, &bridgeAccessory,
        (const HAPAccessory* const[]) { &lightBulbAccessory,
                                        NULL },
        true
    );
}

Full source is available here.

Thanks!

two different lightbulbs one controller

Can I have two different lightbulbs controlled with one controller using HAP? How can I implement that? Could we have more examples besides the lightbulb and the lock?

LightBulb sample application lost connection after a while.

Hi everyone,

I am having an issue with the sample LightBulb application. The HomeKit app is disconnected from the accessory server after idling a few minutes. After that, the HomeKit app cannot connect to the accessory server again. I tried to restart the app but it still not working (I tried to restart the Iphone too). If I restart the accessory server, it can work again.

Here is my log:

   0000  47455420 2f636861 72616374 65726973 74696373 3f69643d 312e3531 20485454    GET /characteristics?id=1.51 HTT
    0020  502f312e 310d0a48 6f73743a 2041636d 655c3033 324c6967 68745c30 33324275    P/1.1..Host: Acme\032Light\032Bu
    0040  6c622e5f 6861702e 5f746370 2e6c6f63 616c0d0a 0d0a                          lb._hap._tcp.local....
2020-05-11'T'11:14:08'Z'        Info    [com.apple.mfi.HomeKit.Core:Characteristic] [0000000000000001 Acme Light Bulb] [0000000000000033 on] Calling read handler.
2020-05-11'T'11:14:08'Z'        Info    HandleLightBulbOnRead: false
2020-05-11'T'11:14:08'Z'        Debug   [com.apple.mfi.HomeKit.Core:IPAccessoryServer] session:0x69b300:<
    0000  48545450 2f312e31 20323030 204f4b0d 0a436f6e 74656e74 2d547970 653a2061    HTTP/1.1 200 OK..Content-Type: a
    0020  70706c69 63617469 6f6e2f68 61702b6a 736f6e0d 0a436f6e 74656e74 2d4c656e    pplication/hap+json..Content-Len
    0040  6774683a 2035300d 0a0d0a7b 22636861 72616374 65726973 74696373 223a5b7b    gth: 50....{"characteristics":[{
    0060  22616964 223a312c 22696964 223a3531 2c227661 6c756522 3a307d5d 7d          "aid":1,"iid":51,"value":0}]}
2020-05-11'T'11:21:32'Z'        Debug   [com.apple.mfi.HomeKit.Core:IPAccessoryServer] session:0x69b300:input closed
2020-05-11'T'11:21:32'Z'        Debug   [com.apple.mfi.HomeKit.Core:IPAccessoryServer] session:0x69b300:closing
2020-05-11'T'11:21:32'Z'        Debug   [com.apple.mfi.HomeKit.Core:IPAccessoryServer] session:0x69b300:closing security context
2020-05-11'T'11:21:32'Z'        Debug   [com.apple.mfi.HomeKit.Core:IPAccessoryServer] Closing HAP session.
2020-05-11'T'11:21:32'Z'        Debug   [com.apple.mfi.HomeKit.Core:Session] HAPSessionRelease
2020-05-11'T'11:21:32'Z'        Debug   [com.apple.mfi.HomeKit.Core:Session] HAPSessionInvalidate
2020-05-11'T'11:21:32'Z'        Debug   [com.apple.mfi.HomeKit.Core:IPAccessoryServer] session:0x69b300:closing TCP stream
2020-05-11'T'11:21:32'Z'        Debug   [com.apple.mfi.HomeKit.Platform:TCPStreamManager] shutdown(11, SHUT_RDWR);
2020-05-11'T'11:21:32'Z'        Debug   [com.apple.mfi.HomeKit.Platform:TCPStreamManager] close(11);
2020-05-11'T'11:21:32'Z'        Debug   [com.apple.mfi.HomeKit.Core:IPAccessoryServer] session:0x69b300:closed
2020-05-11'T'11:21:32'Z'        Debug   [com.apple.mfi.HomeKit.Core:IPAccessoryServer] session:0x69b300:releasing session

I am running Ubuntu 18.04 in a virtual machine (VirtualBox).
Could you please help me with this problem?
Thank you in advance.

Color Temperature ranges

According to HAP its:

  • Minimum Value: 50
  • Maximum Value: 400

But setting from the controller is in range:

  • Minimum Value: 140
  • Maximum Value: 500

Need to fix something: HAP spec or the HomeKit framework

Minor typo in getting_started.md doc.

I believe there is typo in the install instruction...

./Tools/install.sh \
    -d raspi \
    -a Output/Raspi-armv6k-unknown-linux-gnueabihf/Debug/IP/Applications/Lightbulb.OpenSSL \
    -n raspberrypi \
    -p pi

The last line should read

-p raspberry

Unable to build for Raspi

When I run make TARGET=Raspi all I get the following output:

Sending build context to Docker daemon  2.048kB
Step 1/3 : FROM dev-test/raspiadk-base as build
 ---> 079fd7b4cb3b
Step 2/3 : WORKDIR /build
 ---> Using cache
 ---> fe6aec93152f
Step 3/3 : FROM build
 ---> fe6aec93152f
Successfully built fe6aec93152f
/bin/sh: 1: clang: not found
clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1  -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1      -DHAP_TESTING -IPAL/Mock   -DHAP_Test -c PAL/HAPPlatformSystemInit.c -o Output/Raspi-/Test/PAL/HAPPlatformSystemInit.o
clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1  -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1      -DHAP_TESTING -IPAL/Mock   -DHAP_Test -c Tests/HAPCryptoTest.c -o Output/Raspi-/Test/Tests/HAPCryptoTest.o
clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1  -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1      -DHAP_TESTING -IPAL/Mock   -DHAP_Test -c HAP/HAPBLEAccessoryServer.c -o Output/Raspi-/Test/HAP/HAPBLEAccessoryServer.o
clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1  -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1      -DHAP_TESTING -IPAL/Mock   -DHAP_Test -c HAP/HAPPairingPairVerify.c -o Output/Raspi-/Test/HAP/HAPPairingPairVerify.o
make: clang: Command not found
make: clang: Command not found
make: *** [Build/Makefile:108: Output/Raspi-/Test/PAL/HAPPlatformSystemInit.o] Error 127
make: *** Waiting for unfinished jobs....
make: *** [Build/Makefile:108: Output/Raspi-/Test/Tests/HAPCryptoTest.o] Error 127
clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1  -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1      -DHAP_TESTING -IPAL/Mock   -DHAP_Test -c HAP/HAPRequestHandlers+Pairing.c -o Output/Raspi-/Test/HAP/HAPRequestHandlers+Pairing.o
clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1  -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1      -DHAP_TESTING -IPAL/Mock   -DHAP_Test -c HAP/HAPBLETransaction.c -o Output/Raspi-/Test/HAP/HAPBLETransaction.o
make: clang: Command not found
make: clang: Command not found
make: *** [Build/Makefile:108: Output/Raspi-/Test/HAP/HAPBLEAccessoryServer.o] Error 127
make: *** [Build/Makefile:108: Output/Raspi-/Test/HAP/HAPPairingPairVerify.o] Error 127
make: clang: Command not found
make: clang: Command not found
clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1  -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1      -DHAP_TESTING -IPAL/Mock   -DHAP_Test -c HAP/HAPDeviceID.c -o Output/Raspi-/Test/HAP/HAPDeviceID.o
make: *** [Build/Makefile:108: Output/Raspi-/Test/HAP/HAPRequestHandlers+Pairing.o] Error 127
make: *** [Build/Makefile:108: Output/Raspi-/Test/HAP/HAPBLETransaction.o] Error 127
make: clang: Command not found
make: *** [Build/Makefile:108: Output/Raspi-/Test/HAP/HAPDeviceID.o] Error 127
clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1  -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1      -DHAP_TESTING -IPAL/Mock   -DHAP_Test -c HAP/HAPPDU.c -o Output/Raspi-/Test/HAP/HAPPDU.o
make: clang: Command not found
make: *** [Build/Makefile:108: Output/Raspi-/Test/HAP/HAPPDU.o] Error 127
make: *** [all] Error 2

But I have clang installed and it is in my path. Here is the output of clang --version

Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin19.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Raspberry PI Setup and Deployment Fails

Trying to run the RPI setup command fails:

./Tools/install.sh -d raspi -a Output/Raspi-armv6k-unknown-linux-gnueabihf/Debug/IP/Applications/Lightbulb.OpenSSL -n raspberrypi -p raspberry -k

with the error:

ld: warning: dylib (/usr/local/Cellar/[email protected]/1.1.1i/lib/libcrypto.dylib) was built for newer macOS version (10.15) than being linked (10.14)
ld: warning: dylib (/usr/local/Cellar/[email protected]/1.1.1i/lib/libcrypto.dylib) was built for newer macOS version (10.15) than being linked (10.14)
Undefined symbols for architecture x86_64:
  "___asan_version_mismatch_check_apple_clang_1103", referenced from:
      _asan.module_ctor in Darwin.a(HAPBase+ASCII.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Output/Darwin-x86_64-apple-darwin19.6.0/Debug/Tools/SetupPayloadParser.OpenSSL] Error 1
make[1]: *** Waiting for unfinished jobs....
Undefined symbols for architecture x86_64:
  "___asan_version_mismatch_check_apple_clang_1103", referenced from:
      _asan.module_ctor in hap.a(HAPAccessorySetup.o)
      _asan.module_ctor in Darwin.a(HAPAssert.o)
      _asan.module_ctor in hap.a(HAPVersion.o)
      _asan.module_ctor in Darwin.a(HAPPlatformRandomNumber.o)
      _asan.module_ctor in Darwin.a(HAPBase+RawBuffer.o)
      _asan.module_ctor in Darwin.a(HAPBase+String.o)
      _asan.module_ctor in Darwin.a(HAPBase+Int.o)
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Output/Darwin-x86_64-apple-darwin19.6.0/Debug/Tools/AccessorySetupGenerator.OpenSSL] Error 1
make: *** [tools] Error 2

I have confirmed that clang is installed.
Any ideas would be appreciated.

Thanks,

Vulnerability in SRP

Sorry to write this in public issues, but I did not find how submit a vulnerability report!

First of all, Happy New Year !

We would like to report a vulnerability of the SRP implementation (PAL/Crypto/OpenSSL/HAPOpenSSL.c)
Indeed, the implementation relies on OpenSSL Big Number implementations.
More importantly, it relies on the OpenSSL function BN_mod_exp without setting the BN_FLG_CONSTTIME.
The consequence is that the function BN_mod_exp (in OpenSSL crypto/bn/bn_exp.c) calls the function BN_mod_exp_mont_word (in OpenSSL crypto/bn/bn_exp.c)

Roughly speaking, the vulnerability is caused by the nature non constant-time of the function BN_mod_exp_mont_word.
The attack was tested on OpenSSL 1.1.1h, but should work on other versions too.

We show the attack by exploiting SRP.
By design, SRP is supposed to resist offline dictionary attacks. However, we show that such attacks are still possible to recover the used password efficiently, by exploiting some data leakage during an insecure modular exponentiation.

A PoC is available here (it shows SRP in OpenSSL, but it works perfectly fine on Erlang also): https://gitlab.inria.fr/ddealmei/poc-openssl-srp
We contacted OpenSSL, and they are fixing only the part concerning OpenSSL in crypto/srp/srp_lib.c.

Apple HomeKit should include its own fix by setting the flag BN_FLG_CONSTTIME on the exponent variable of bn_mod_exp.

We will be glad to provide further information if needed.
This is my email if you would like more private discussion: [email protected]

Best regards,
Mohamed SABT, Associate Professor at the University of Rennes 1 and Researcher at IRISA in France

Installing on Rasberry Pi

If I want install ADK on a Rasberry Pi, docker must be installed on Mac, not on Raspberry Pi, right?

Default install incomplete

During setup on macOS 10.15.4, the default installer lacked setup for sphinx-build. MacOS doesn't have python3 by default, installing python3 via homebrew results in some issue where you basically need to add sphinx-build to the path using the line below;

PATH="$HOME/Library/Python/3.7/bin:$PATH

sphinx-build installs correctly, sphinx installs correctly, ended up installing sphinx-autobuild attempting to resolve the issue by accident -- works fine regardless.

Unable to find image 'make:latest' locally

Sending build context to Docker daemon 2.048kB Step 1/3 : FROM ubuntu:18.04 Get https://registry-1.docker.io/v2/library/ubuntu/manifests/18.04: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fubuntu%3Apull&service=registry.docker.io: unexpected EOF Unable to find image 'make:latest' locally docker: Error response from daemon: Get https://registry-1.docker.io/v2/library/make/manifests/latest: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fmake%3Apull&service=registry.docker.io: unexpected EOF. See 'docker run --help'. make: *** [Makefile:67: docs] Error 125

Why? And how do i compile it to a dll for example to use it in C#?

install.sh : fatal error: 'openssl/evp.h' file not found

when performing the install.sh, I receive the following error:

r cr Output/Darwin-x86_64-apple-darwin19.3.0/Debug/Darwin.a Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/HAPAssert.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/HAPBase+Crypto.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/HAPBase+Double.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/HAPBase+Float.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/HAPBase+Int.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/HAPBase+MACAddress.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/HAPBase+RawBuffer.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/HAPBase+Sha1Checksum.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/HAPBase+String.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/HAPBase+UTF8.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/HAPLog.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/HAPPlatformSystemInit.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/Darwin/HAPPlatform.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/Darwin/HAPPlatformAbort.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/Darwin/HAPPlatformAccessorySetup.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/Darwin/HAPPlatformAccessorySetupDisplay.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/Darwin/HAPPlatformAccessorySetupNFC.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/Darwin/HAPPlatformBLEPeripheralManager.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/Darwin/HAPPlatformClock.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/Darwin/HAPPlatformKeyValueStore.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/Darwin/HAPPlatformLog.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/Darwin/HAPPlatformMFiHWAuth.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/Darwin/HAPPlatformMFiTokenAuth.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/Darwin/HAPPlatformRandomNumber.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/Darwin/HAPPlatformRunLoop.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/Darwin/HAPPlatformServiceDiscovery.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/Darwin/HAPPlatformTCPStreamManager.o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/Darwin/HAPPlatformTimer.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1 -mmacosx-version-min=10.14   -DDARWIN=1 -Werror=unused-function -Wno-expansion-to-defined -Wno-nullability-completeness -Wno-deprecated-declarations -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -ICommon -I/include -I/include -O0 -g -DHAP_LOG_LEVEL=3     -DHAP_TESTING -IPAL/Darwin -IPAL/Darwin -ICommon   -DHAP_Debug -c PAL/Crypto/OpenSSL/HAPOpenSSL.c -o Output/Darwin-x86_64-apple-darwin19.3.0/Debug/PAL/Crypto/OpenSSL/HAPOpenSSL.o
/opt/local/bin/ranlib: object: Output/Darwin-x86_64-apple-darwin19.3.0/Debug/Darwin.a(HAPAssert.o) malformed object (unknown load command 1)
ar: internal ranlib command failed
make[1]: *** [Output/Darwin-x86_64-apple-darwin19.3.0/Debug/Darwin.a] Error 1
make[1]: *** Waiting for unfinished jobs....
/opt/local/bin/ranlib: object: Output/Darwin-x86_64-apple-darwin19.3.0/Debug/hap.a(HAPAccessory+Info.o) malformed object (unknown load command 1)
ar: internal ranlib command failed
make[1]: *** [Output/Darwin-x86_64-apple-darwin19.3.0/Debug/hap.a] Error 1
PAL/Crypto/OpenSSL/HAPOpenSSL.c:10:10: fatal error: 'openssl/evp.h' file not found
#include <openssl/evp.h>
         ^~~~~~~~~~~~~~~

Missing TV Characteristics / Services?

Is the characteristics / services for TV missing or am I missing something? I see most of the other characteristics and services but nothing to deal with the remote and or the TV services. Is this in the works or out of scope of this project? Thanks.

Build error caused by XCode SDK

Hello everyone,

I am having a compile error between openssl and Xcode SDK :

In file included from /usr/local/Cellar/[email protected]/1.1.1g/include/openssl/crypto.h:415:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/pthread.h:332:5: error:
declaration of built-in function 'pthread_create' requires inclusion of the
header <pthread.h> [-Werror,-Wbuiltin-requires-header]
int pthread_create(pthread_t _Nullable * _Nonnull __restrict,
^
1 error generated.

I am compiling on a macOS Catalina.
Could you please help me with this problem ?

Thanks in advance

Default memory footprint is too large

With default values for kHAPIPSessionStorage_DefaultNumElements (17), kHAPIPSession_DefaultInboundBufferSize (32K) and kHAPIPSession_DefaultOutboundBufferSize (32K) the RAM footprint of a basic app ends up being over 1M.
Pre-allocating all the buffers is safe in terms of peak memory footprint but is unacceptable for smaller platforms - e.g. on ESP8266 we only have 40K or so to work with, ESP32 has 200K or so, STM32 MCUs typically used in IoT applications have 128K to 1M of RAM total.
For the library to be usable on those platforms, this needs to be addressed.

Immediate question: why are buffers 32K in size when the HAP protocol defines maximum payload size for an HTTP request at 1K? (HomeKit Accessory Protocol Specification non-Commercial Version R2, section 6.5.2)

Question regarding the Position State characteristic

(This is not an ADK question as such but maybe you can answer it or at least direct me where to ask it instead)

Window Covering service includes a Position State characteristic that has three possible values:

0 ”Going to the minimum value specified in metadata”
1 ”Going to the maximum value specified in metadata”
2 ”Stopped”

In the context of the window covering service, I read 0 to mean "Going to fully closed position (0%)" and 1 to mean "Going to fully open state (100%)" - this is what "metadata" (i.e. spec) defines as maximum and minimum values for the target and current positions.
However, it's not clear to me what this characteristic should report when the curtain is moving to an intermediate position - e.g., user moved the slider to 60%, Home app sent a write to target position with value 60 and we are moving now, so we are not stopped. However, we are not moving to the 100% position so we can't say we are moving to the minimum or the maximum value. What should an accessory report in that case?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.