servo: tighten assertion on set_nocheck

set_nocheck asserts both gpio_name and gpio_value. However, passing 0
for instance is a perfectly valid gpio value. The real issue (I think)
this is trying to solve is that we cannot send None throught the xmlrpc.
This change specifically guards against that, tightening the assertion
and relaxing permissible input values.

BUG=None
TEST=manual test
test_that $DUT_IP platform_ServoPowerStateController_USBUnplugged

works fine

Change-Id: I658d5141dff3e5c5f6adda5fea01245cbfc75f63
Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1676860
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Garry Wang <xianuowang@chromium.org>
diff --git a/server/cros/servo/servo.py b/server/cros/servo/servo.py
index 11012b5..9731f59 100644
--- a/server/cros/servo/servo.py
+++ b/server/cros/servo/servo.py
@@ -673,7 +673,8 @@
         @param gpio_name Name of the gpio.
         @param gpio_value New setting for the gpio.
         """
-        assert gpio_name and gpio_value
+        # The real danger here is to pass a None value through the xmlrpc.
+        assert gpio_name and gpio_value is not None
         logging.debug('Setting %s to %r', gpio_name, gpio_value)
         try:
             self._server.set(gpio_name, gpio_value)