OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var known_devices = {}; | 5 var known_devices = {}; |
6 | 6 |
7 chrome.hid.onDeviceRemoved.addListener(function (deviceId) { | 7 chrome.usb.onDeviceRemoved.addListener(function(device) { |
8 if (deviceId in known_devices) { | 8 if (device.device in known_devices) { |
9 chrome.test.sendMessage("success"); | 9 chrome.test.sendMessage("success"); |
10 } else { | 10 } else { |
11 console.error("Unexpected device removed: " + device.deviceId); | 11 console.error("Unexpected device removed: " + device.device); |
12 chrome.test.sendMessage("failure"); | 12 chrome.test.sendMessage("failure"); |
13 } | 13 } |
14 }); | 14 }); |
15 | 15 |
16 chrome.hid.getDevices({}, function (devices) { | 16 chrome.usb.getDevices({}, function(devices) { |
17 for (var device of devices) { | 17 for (var device of devices) { |
18 known_devices[device.deviceId] = device; | 18 known_devices[device.device] = device; |
19 } | 19 } |
20 chrome.test.sendMessage("loaded"); | 20 chrome.test.sendMessage("loaded"); |
21 }); | 21 }); |
OLD | NEW |