New issue
Advanced search Search tips

Issue 891359 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2
Cc:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug

Blocking:
issue 841121



Sign in to add a comment

servod: vendor and product arguments broken

Project Member Reported by amstan@chromium.org, Oct 2

Issue description

This morning my servod didn't really want to cooperate.

I usually have --vendor and --product in my command line because servod frequently wants to open my other ftdi devices at my desk.

This morning:
"sudo servod --vendor 0x18d1 --product 0x5002 -b cheza" yielded
usage: servod....
servod: error: argument --vendor: invalid int value: '0x18d1'

Something must have changed in the argument parsing code where it doesn't like hex values anymore. I checked out a version of servod from 2 months ago, it seems fine (even though the parser.add_option code still says type=int).

Ruben, could you please take a look?
 
Status: Started (was: Available)
Hi, sorry to cause you issues.
I recently updated servod from optparse to argparse. According to the internets, it seems that argparse's int really just calls int(input) which fails on a hex string.
I'll try to push a change in the next hour or so after testing it out
review here https://crrev.com/c/1258722

Could you try this out and let me know if it successfully addresses your issue?
Project Member

Comment 3 by bugdroid1@chromium.org, Oct 3

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/hdctools/+/a3fe8e9fdd51f6a2e9e42383c9dcadf74fa64025

commit a3fe8e9fdd51f6a2e9e42383c9dcadf74fa64025
Author: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Date: Wed Oct 03 20:59:03 2018

servod: allow hex input for vid/pid in parser

This replaces the type "int" for --vendor/--product cmdline arguments
with the type lambda x: int(x,0) to ensure that hex values also get
converted to ints.

BUG= chromium:891359 
TEST=manual test

(Before the change)
sudo servod --vendor 0x9181
servod: error: argument --vendor: invalid int value: '0x9181'
(After the change)
sudo servod --vendor 0x9181
2018-10-03 09:52:43,518 - servod - INFO - Start
...

Change-Id: I85634d777578c5551776b1c9341dbfd046c993cd
Reviewed-on: https://chromium-review.googlesource.com/1258722
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Alexandru M Stan <amstan@chromium.org>
Tested-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>

[modify] https://crrev.com/a3fe8e9fdd51f6a2e9e42383c9dcadf74fa64025/servo/servod.py

Status: Fixed (was: Started)

Sign in to add a comment