aboutsummaryrefslogtreecommitdiff
path: root/device.cc
Commit message (Collapse)AuthorAge
* Change std::wstring to std::string in DeviceInfoRobin Krahl2019-01-13
| | | | | | | For easier handling, we should use a std::string instead of std::wstring for the serial number in DeviceInfo. For the conversion, I assume that the serial number is valid UTF-8. As it should be alphanumeric and ASCII only, this should be true.
* Implement operator<< for DeviceModelRobin Krahl2019-01-13
|
* Add Device::create static methodRobin Krahl2019-01-13
| | | | | The method makes it easier to create a std::shared_ptr<Device> from a model enum instance.
* Make Device::enumerate staticRobin Krahl2019-01-13
| | | | | | | | | | | Device::enumerate does not need any instance data, therefore it is made static. Note that this not only changes the public API by making the method static. We also return all connected Nitrokey devices instead of only Storage devices. The NitrokeyManager method list_devices_by_cpuID is changed to check the device type so that they still only return Storage devices. The list_device method now returns both Storage and Pro devices.
* Add product_id_to_model functionRobin Krahl2019-01-13
|
* Extract vendor and product IDs into constantsRobin Krahl2019-01-13
|
* Change Device::enumerate return type to use DeviceInfoRobin Krahl2019-01-13
| | | | | | The return type of Device::enumerate is changed from std::vector<std::string> to std::vector<DeviceInfo> to expose the additional information contained in the DeviceInfo struct.
* Fix log warning regarding repeated disconnectionSzczepan Zalega2018-06-20
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Make unbundling easierDavid Seifert2018-03-13
|
* Log current device IDSzczepan Zalega2018-02-28
| | | | | | | | Allow logger to set global prefix Used to indicate current device Store USB path when used to connection as well Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Show connection success/failure on DEBUG_L1Szczepan Zalega2018-02-28
| | | | | | Clarify disconnection log message Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Initial support for multiple devices with C++ and testSzczepan Zalega2018-02-28
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Update license/copyright linesSzczepan Zalega2018-01-16
| | | | | | Remove redundant file Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Update device propertiesSzczepan Zalega2017-10-10
| | | | | | | Increase device delays Increase retry count Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Make only 10 retries on receivingSzczepan Zalega2017-09-20
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Log formatting: Enumerate from 1Szczepan Zalega2017-09-20
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Do not resend command to deviceSzczepan Zalega2017-09-20
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Use bool explicitly for success variableSzczepan Zalega2017-05-12
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Use alternative device connection checkSzczepan Zalega2017-04-26
| | | | | | | Do not use hid_enumarate under OSX Hidapi: do not call event loop on OSX Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Fix compilation warningsSzczepan Zalega2017-03-31
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Allow to change device commands delays runtimeSzczepan Zalega2017-03-29
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Never call hid exit on OSXSzczepan Zalega2017-03-13
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Set turbo modeSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Check for null device reference in case of failed reconnectionSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Remove obsolete commentsSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Do reconnect also on receiving failureSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Remove checking for mutex being lockedSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Make device-level reconnect on problem with sendingSzczepan Zalega2017-03-11
| | | | | | | Make it 3 times before throwing exception Call hid_exit on last device disconnection Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Build debug-log-free library for increased securitySzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Rename is_connected to be more specificSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Decrease retry count in the lowest levelSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Fix typosSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Do not call hid_exit on each device disconnectionSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Correct device countersSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Adjust for compilation on Visual Studio 2017Szczepan Zalega2017-03-11
| | | | Building works however tests are not. Possibly linking with original hidapi solution would work.
* Make statistics about device's connectionSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Throw before communicating with device if it is not initializedSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Add method for checking is the device listed as connected in OSSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Decrease retry count to 20Szczepan Zalega2017-03-11
| | | | | | Update log message to be more readable Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* More debug log info during dev connectionSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Use nullptr instead of NULLSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Use lock_guard while accessing hid_apiSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Make device configuration const, protect non-const with ::atomicSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Make device slower for now for easier debuggingSzczepan Zalega2016-11-26
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Code refactoring: removing disambiguity from device constantsSzczepan Zalega2016-10-19
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Set shorter delays in sending/receiving packets (2)Szczepan Zalega2016-10-19
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Set shorter delays in sending/receiving packetsSzczepan Zalega2016-10-19
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Increase retry timeout for NK Storage for nowSzczepan Zalega2016-10-19
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Fixed bug with not releasing device on disconnectSzczepan Zalega2016-10-19
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Increase delay and retry count for response receivingSzczepan Zalega2016-08-05
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>