aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurjant Kalsi <me@gurjantkalsi.com>2016-04-25 13:00:46 -0700
committerGurjant Kalsi <me@gurjantkalsi.com>2016-04-25 13:00:46 -0700
commit8d466f9441408c86f9f7b25114e249b01cf5320f (patch)
treed823ce857e8a1235c5c4de755f32d50f10fdc5ed
parent604a2bff74254bcf2759f8b839db0c18f78560d6 (diff)
downloadcommon-8d466f9441408c86f9f7b25114e249b01cf5320f.tar.gz
[mtldr] Add udev rules, use new vid/pid, separate bootloader usb from main system usb.
-rw-r--r--target/dartuinoP0/projects/system/system_stubs.c3
-rw-r--r--target/dartuinoP0/usb.c7
-rw-r--r--tools/moot/95-coral.rules8
-rwxr-xr-x[-rw-r--r--]tools/moot/mtldr (renamed from tools/moot/mtldr.py)8
-rw-r--r--tools/moot/requirements.txt1
5 files changed, 19 insertions, 8 deletions
diff --git a/target/dartuinoP0/projects/system/system_stubs.c b/target/dartuinoP0/projects/system/system_stubs.c
index 8bef4c7e..d359f1a7 100644
--- a/target/dartuinoP0/projects/system/system_stubs.c
+++ b/target/dartuinoP0/projects/system/system_stubs.c
@@ -22,7 +22,8 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <lib/ndebug/ndebug.h>
void append_usb_interfaces(void)
{
- // no-op
+ ndebug_init();
} \ No newline at end of file
diff --git a/target/dartuinoP0/usb.c b/target/dartuinoP0/usb.c
index 11f44a24..bf340d88 100644
--- a/target/dartuinoP0/usb.c
+++ b/target/dartuinoP0/usb.c
@@ -26,7 +26,6 @@
#include <dev/usbc.h>
#include <err.h>
#include <hw/usb.h>
-#include <lib/ndebug/ndebug.h>
#include <lk/init.h>
#include <stdio.h>
#include <target.h>
@@ -48,8 +47,8 @@ static const uint8_t dev_descr[] = {
0xff, /* subclass */
0xff, /* protocol */
64, /* max packet size, ept0 */
- W(0x9999), /* vendor */
- W(0x9999), /* product */
+ W(0x18D1), /* vendor */
+ W(0xA010), /* product */
W(0x9999), /* release */
0x2, /* manufacturer string */
0x1, /* product string */
@@ -102,7 +101,7 @@ void target_usb_setup(void)
{
usb_setup(&config);
- ndebug_init();
+ append_usb_interfaces();
usb_add_string("LK", 1);
usb_add_string("LK Industries", 2);
diff --git a/tools/moot/95-coral.rules b/tools/moot/95-coral.rules
new file mode 100644
index 00000000..7567e509
--- /dev/null
+++ b/tools/moot/95-coral.rules
@@ -0,0 +1,8 @@
+ACTION!="add|change", GOTO="coral_rules_end"
+SUBSYSTEM!="usb", GOTO="coral_rules_end"
+ENV{DEVTYPE}!="usb_device", GOTO="coral_rules_end"
+
+# ST-LINK/V2
+ATTRS{idVendor}=="18D1", ATTRS{idProduct}=="A010", MODE="777"
+
+LABEL="coral_rules_end" \ No newline at end of file
diff --git a/tools/moot/mtldr.py b/tools/moot/mtldr
index b69ee154..e7eb58cd 100644..100755
--- a/tools/moot/mtldr.py
+++ b/tools/moot/mtldr
@@ -1,3 +1,5 @@
+#! /usr/bin/env python
+
"""
Copyright 2016 Google Inc. All Rights Reserved.
Author: gkalsi@google.com (Gurjant Kalsi)
@@ -67,14 +69,14 @@ class CommandParam:
def __init__(self, data_phase_type):
self.data_phase_type = data_phase_type
-VENDOR_ID = 0x9999
-PRODUCT_ID = 0x9999
+VENDOR_ID = 0x18D1
+PRODUCT_ID = 0xA010
CLASS_VENDOR_SPECIFIC = 0xFF
SUBCLASS_MTLDR_DEBUG = 0x01
# create logger
logger = logging.getLogger('mtldr')
-logger.setLevel(logging.WARN)
+logger.setLevel(logging.INFO)
class FindByDeviceClass(object):
diff --git a/tools/moot/requirements.txt b/tools/moot/requirements.txt
new file mode 100644
index 00000000..c35274d2
--- /dev/null
+++ b/tools/moot/requirements.txt
@@ -0,0 +1 @@
+pyusb==1.0.0rc1