summaryrefslogtreecommitdiffstats
path: root/src/nolo.c
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2012-08-12 12:21:49 +0200
committerPali Rohár <pali.rohar@gmail.com>2012-08-12 12:21:49 +0200
commitd35d6142caa2d0a8c7401d5999739ecc2429609e (patch)
treeb8a06077c91b2531d316249cef69e06fe3134c8b /src/nolo.c
parent2d52d8c3c647cbfe0ca0c04b87bc7298d5cca14d (diff)
download0xFFFF-d35d6142caa2d0a8c7401d5999739ecc2429609e.tar.bz2
nolo: Respect simulate flag
Diffstat (limited to 'src/nolo.c')
-rw-r--r--src/nolo.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nolo.c b/src/nolo.c
index 4c7c595..76919da 100644
--- a/src/nolo.c
+++ b/src/nolo.c
@@ -212,6 +212,8 @@ int nolo_get_root_device(struct usb_device_info * dev) {
int nolo_set_root_device(struct usb_device_info * dev, int device) {
printf("Setting root device to %d...\n", device);
+ if ( simulate )
+ return 0;
if ( usb_control_msg(dev->udev, NOLO_WRITE, NOLO_SET, device, NOLO_ROOT_DEVICE, NULL, 0, 2000) < 0 )
ERROR_RETURN("Cannot set root device", -1);
return 0;
@@ -230,6 +232,8 @@ int nolo_get_usb_host_mode(struct usb_device_info * dev) {
int nolo_set_usb_host_mode(struct usb_device_info * dev, int enable) {
printf("%s USB host mode...\n", enable ? "Enabling" : "Disabling");
+ if ( simulate )
+ return 0;
if ( usb_control_msg(dev->udev, NOLO_WRITE, NOLO_SET, enable, NOLO_USB_HOST_MODE, NULL, 0, 2000) < 0 )
ERROR_RETURN("Cannot change USB host mode status", -1);
return 0;
@@ -248,6 +252,8 @@ int nolo_get_rd_mode(struct usb_device_info * dev) {
int nolo_set_rd_mode(struct usb_device_info * dev, int enable) {
printf("%s R&D mode...\n", enable ? "Enabling" : "Disabling");
+ if ( simulate )
+ return 0;
if ( usb_control_msg(dev->udev, NOLO_WRITE, NOLO_SET, enable, NOLO_RD_MODE, NULL, 0, 2000) < 0 )
ERROR_RETURN("Cannot change R&D mode status", -1);
return 0;
@@ -358,6 +364,9 @@ int nolo_set_rd_flags(struct usb_device_info * dev, const char * flags) {
if ( ! ( add_flags & NOLO_RD_FLAG_FORCE_POWER_KEY ) )
del_flags |= NOLO_RD_FLAG_FORCE_POWER_KEY;
+ if ( simulate )
+ return 0;
+
if ( usb_control_msg(dev->udev, NOLO_WRITE, NOLO_SET, add_flags, NOLO_ADD_RD_FLAGS, NULL, 0, 2000) < 0 )
ERROR_RETURN("Cannot add R&D flags", -1);