File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -198,7 +198,12 @@ func (a *Adapter) Scan(callback func(*Adapter, ScanResult)) error {
198198 case "UUIDs" :
199199 props .UUIDs = val .Value ().([]string )
200200 case "ManufacturerData" :
201- props .ManufacturerData = val .Value ().(map [uint16 ]interface {})
201+ // work around for https://github.com/muka/go-bluetooth/issues/163
202+ mData := make (map [uint16 ]interface {})
203+ for k , v := range val .Value ().(map [uint16 ]dbus.Variant ) {
204+ mData [k ] = v .Value ().(interface {})
205+ }
206+ props .ManufacturerData = mData
202207 }
203208 }
204209 callback (a , makeScanResult (props ))
@@ -241,8 +246,12 @@ func makeScanResult(props *device.Device1Properties) ScanResult {
241246
242247 mData := make (map [uint16 ][]byte )
243248 for k , v := range props .ManufacturerData {
244- temp := v .(dbus.Variant )
245- mData [k ] = temp .Value ().([]byte )
249+ switch val := v .(type ) {
250+ case dbus.Variant :
251+ mData [k ] = val .Value ().([]byte )
252+ case []byte :
253+ mData [k ] = val
254+ }
246255 }
247256
248257 return ScanResult {
You can’t perform that action at this time.
0 commit comments