Commit 07787027 authored by ccollins476ad's avatar ccollins476ad Committed by Kevin
Browse files

Interpret missing kCBMsgArgResult as success. (#5)

This commit addresses a panic that occurs in older versions of MacOS
(tested with 10.11.5).  The problem occurs because, on this machine, the
DiscoverDescriptors response lacks a `kCBMsgArgResult` field.  This
missing field must have gotten fixed in a subsequent version of MacOS.
Here are the contents of the DiscoverDescriptors response:

```
map[kCBMsgArgCharacteristicHandle:17 kCBMsgArgDeviceUUID:3e8e65b72da94f70bbbe2d8f1a2524ee kCBMsgArgDescriptors:[]]
```

The fix is to treat a response that lacks the `kCBMsgArgResult` field as
indicating success.  That is, pretend `kCBMsgArgResult` is 0.
parent c88cfeb1
......@@ -35,7 +35,7 @@ func (m msg) deviceUUID() xpc.UUID { return xpc.Dict(m).MustGetUUID("kCBMs
func (m msg) ignoreResponse() int { return xpc.Dict(m).MustGetInt("kCBMsgArgIgnoreResponse") }
func (m msg) offset() int { return xpc.Dict(m).MustGetInt("kCBMsgArgOffset") }
func (m msg) isNotification() int { return xpc.Dict(m).GetInt("kCBMsgArgIsNotification", 0) }
func (m msg) result() int { return xpc.Dict(m).MustGetInt("kCBMsgArgResult") }
func (m msg) result() int { return xpc.Dict(m).GetInt("kCBMsgArgResult", 0) }
func (m msg) state() int { return xpc.Dict(m).MustGetInt("kCBMsgArgState") }
func (m msg) rssi() int { return xpc.Dict(m).MustGetInt("kCBMsgArgData") }
func (m msg) transactionID() int { return xpc.Dict(m).MustGetInt("kCBMsgArgTransactionID") }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment