Open tanepiper opened 3 years ago
Currently, I am on OSX Big Sur 11.2 with node v14.15.3
@kevinmehall Does https://github.com/tessel/node-usb have support for running on Big Sur? (I don't see why it wouldn't, but you'd know best and it doesn't hurt to ask).
but I also tried to see if I can get this working on Windows but no luck either.
@tanepiper Can you describe that setup a bit more? Are you using the built-in command prompt? Can you confirm that you followed the instructions given for Windows here: http://tessel.github.io/t2-start/index.html. Thanks!
@rwaldron Yes, I went through each of the steps described in the docs on OSX and Windows.
Windows I tried cmd and Powershell, I also tried Bash on WSL. I haven't been able to try Linux (and might not be able to as I've since bricked the device and can't currently get it re-flashed using flash.py from https://github.com/tessel/t2-firmware)
How I bricked it might also help?
1: Created a public and private key
2: Connected via serial to the device, put the public key in /etc/dropbear/authorized_keys
3: At this point was able to SSH in fine - node installed on the device was 4.7.1
- so thought maybe upgrading might help fix this issue
4: Connect via SFTP to the device and uploaded the openwrt-ramips-mt7620-tessel-squashfs-sysupgrade.bin
and ran the upgrade.
At this point any time I tried to use the CLI tool I kept getting segfaults from the USB device (it would find it on the LAN fine still) - an entirely new error!
I then tried flashing openwrt-ramips-mt7620-Default-u-boot.bin
but that screwed up and caused the Bad Magic Number
error - flash.py
won't help because it seems it was for Python2, and updating code to Python3 seems to cause the page to go past the USB write limit and time out, and I haven't figure out how to fix it.
If I can recover the device I can keep testing but this is as far as I got.
I know node-usb
has worked for at least one person on Big Sur. On M1 processors, installation will build the C++ module from source because we don't publish prebuilds for arm64.
@tanepiper What did you use to flash u-boot and what's the serial port output on boot now? If you broke u-boot, there's also t2 restore
, which is a JS version of flash.py
.
@kevinmehall I'm on Intel so it's not an ARM issue.
So amazingly t2 restore
is working :) I can now boot again - but still t2 list
only sees the device on LAN and not USB (also t2 update
, provision
, etc still don't find it)
I've captured the serial log:
INFO Connecting to Tessel... (Ctrl+D to exit)
olocate_code Pointer at: 83fb8000
enable ephy clock...done. rf reg 29 = 5
SSC disabled.
Now running in RAM - U-Boot at: 83fb8000
monitor_flash_len =92408
Command "rf": 0xbc0017dc => 0x83fb97dc
Command "mdio": 0xbc005e78 => 0x83fbde78
Command "erase": 0xbc006fb4 => 0x83fbefb4
Command "cp": 0xbc00752c => 0x83fbf52c
Command "reset": 0xbc012070 => 0x83fca070
Command "go": 0xbc007a30 => 0x83fbfa30
Command "bootm": 0xbc00807c => 0x83fc007c
Command "loadb": 0xbc008c90 => 0x83fc0c90
Command "tftpboot": 0xbc0092f0 => 0x83fc12f0
Command "nm": 0xbc009cd4 => 0x83fc1cd4
Command "mm": 0xbc009c70 => 0x83fc1c70
Command "md": 0xbc0097a4 => 0x83fc17a4
Command "saveenv": 0xbc00a248 => 0x83fc2248
Command "setenv": 0xbc00a958 => 0x83fc2958
Command "printenv": 0xbc009fd8 => 0x83fc1fd8
Command "?": 0xbc00ac50 => 0x83fc2c50
Command "help": 0xbc00ac50 => 0x83fc2c50
Command "version": 0xbc00ab10 => 0x83fc2b10
spi_wait_nsec: 29
spi device id: 1 2 19 4d 1 (2194d01)
find flash: S25FL256S
raspi_read: from:30000 len:1000
*** Warning - bad CRC, using default environment
============================================
Ralink UBoot Version: 4.1.1.0
--------------------------------------------
ASIC 7620_MP (Port5<->None)
DRAM component: 512 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 64 MBytes
Flash component: SPI Flash
Date:Dec 16 2015 Time:06:41:59
============================================
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768
##### The CPU freq = 580 MHZ ####
estimate memory size =64 Mbytes
3: System Boot system code via Flash.
## Booting image at bc050000 ...
raspi_read: from:50000 len:40
Image Name: MIPS OpenWrt Linux-3.18.17
Image Type: MIPS Linux Kernel Image (lzma compressed)
Data Size: 1154112 Bytes = 1.1 MB
Load Address: 80000000
Entry Point: 80000000
raspi_read: from:50040 len:119c40
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 64
Starting kernel ...
[ 0.000000] Linux version 3.18.17 (root@tessel-builder) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r46286) ) #1 Thu Apr 7 14:09:26 EDT 2016
[ 0.000000] Board has DDR2
[ 0.000000] Analog PMU set to hw control
[ 0.000000] Digital PMU set to hw control
[ 0.000000] SoC Type: Ralink MT7620N ver:2 eco:6
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] CPU0 revision is: 00019650 (MIPS 24KEc)
[ 0.000000] MIPS: machine is Tessel
[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 04000000 @ 00000000 (usable)
[ 0.000000] Initrd not found or empty - disabling initrd
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x00000000-0x03ffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x00000000-0x03ffffff]
[ 0.000000] Initmem setup node 0 [mem 0x00000000-0x03ffffff]
[ 0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[ 0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
[ 0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[ 0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Writing ErrCtl register=0003e72a
[ 0.000000] Readback ErrCtl register=0003e72a
[ 0.000000] Memory: 61308K/65536K available (2554K kernel code, 124K rwdata, 524K rodata, 180K init, 186K bss, 4228K reserved)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS:256
[ 0.000000] CPU Clock: 580MHz
[ 0.000000] systick: running - mult: 214748, shift: 32
[ 0.000000] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[ 0.060000] pid_max: default: 32768 minimum: 301
[ 0.060000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.070000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.070000] pinctrl core: initialized pinctrl subsystem
[ 0.080000] NET: Registered protocol family 16
[ 0.100000] rt2880_gpio 10000600.gpio: registering 24 gpios
[ 0.100000] rt2880_gpio 10000600.gpio: registering 24 irq handlers
[ 0.110000] rt2880_gpio 10000638.gpio: registering 16 gpios
[ 0.110000] rt2880_gpio 10000638.gpio: registering 16 irq handlers
[ 0.120000] rt2880_gpio 10000660.gpio: registering 32 gpios
[ 0.120000] rt2880_gpio 10000660.gpio: registering 32 irq handlers
[ 0.130000] rt2880_gpio 10000688.gpio: registering 1 gpios
[ 0.130000] rt2880_gpio 10000688.gpio: registering 1 irq handlers
[ 0.140000] Switched to clocksource systick
[ 0.140000] NET: Registered protocol family 2
[ 0.150000] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.150000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.160000] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.160000] TCP: reno registered
[ 0.170000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.170000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.180000] NET: Registered protocol family 1
[ 0.180000] rt-timer 10000100.timer: maximum frequency is 2441Hz
[ 0.190000] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 0.210000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.210000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[ 0.220000] msgmni has been set to 119
[ 0.230000] io scheduler noop registered
[ 0.230000] io scheduler deadline registered (default)
[ 0.240000] drivers/phy/phy-ralink-usb.c:ralink_usb_phy_probe[147]
[ 0.240000] drivers/phy/phy-ralink-usb.c:ralink_usb_phy_probe[161]
[ 0.250000] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[ 0.260000] console [ttyS0] disabled
[ 0.260000] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 20, base_baud = 2500000) is a 16550A
[ 0.270000] console [ttyS0] enabled
[ 0.270000] console [ttyS0] enabled
[ 0.270000] bootconsole [early0] disabled
[ 0.270000] bootconsole [early0] disabled
[ 0.300000] m25p80 spi32766.0: s25fl256s1 (32768 Kbytes)
[ 0.300000] 4 ofpart partitions found on MTD device spi32766.0
[ 0.310000] Creating 4 MTD partitions on "spi32766.0":
[ 0.310000] 0x000000000000-0x000000030000 : "u-boot"
[ 0.320000] 0x000000030000-0x000000040000 : "u-boot-env"
[ 0.330000] 0x000000040000-0x000000050000 : "factory"
[ 0.330000] 0x000000050000-0x000002000000 : "firmware"
[ 0.460000] 2 uimage-fw partitions found on MTD device firmware
[ 0.460000] 0x000000050000-0x000000169c80 : "kernel"
[ 0.470000] 0x000000169c80-0x000002000000 : "rootfs"
[ 0.480000] mtd: device 5 (rootfs) set to be root filesystem
[ 0.480000] 1 squashfs-split partitions found on MTD device rootfs
[ 0.490000] 0x000001270000-0x000002000000 : "rootfs_data"
[ 0.500000] ralink_soc_eth 10100000.ethernet eth0 (uninitialized): port 1 link up (100Mbps/Full duplex)
[ 0.510000] ralink_soc_eth 10100000.ethernet: loaded mt7620 driver
[ 0.520000] ralink_soc_eth 10100000.ethernet eth0: ralink at 0xb0100000, irq 5
[ 0.520000] rt2880_wdt 10000120.watchdog: Initialized
[ 0.530000] TCP: cubic registered
[ 0.530000] NET: Registered protocol family 17
[ 0.540000] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[ 0.550000] 8021q: 802.1Q VLAN Support v1.8
[ 0.570000] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
[ 0.580000] Freeing unused kernel memory: 180K (80323000 - 80350000)
[ 2.420000] init: Console is alive
[ 2.430000] init: - watchdog -
[ 5.290000] usbcore: registered new interface driver usbfs
[ 5.300000] usbcore: registered new interface driver hub
[ 5.300000] usbcore: registered new device driver usb
[ 5.320000] SCSI subsystem initialized
[ 5.330000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 5.340000] ehci-platform: EHCI generic platform driver
[ 5.540000] phy phy-usbphy.0: remote usb device wakeup disabled
[ 5.550000] phy phy-usbphy.0: UTMI 16bit 30MHz
[ 5.550000] ehci-platform 101c0000.ehci: EHCI Host Controller
[ 5.560000] ehci-platform 101c0000.ehci: new USB bus registered, assigned bus number 1
[ 5.570000] ehci-platform 101c0000.ehci: irq 26, io mem 0x101c0000
[ 5.590000] ehci-platform 101c0000.ehci: USB 2.0 started, EHCI 1.00
[ 5.590000] hub 1-0:1.0: USB hub found
[ 5.600000] hub 1-0:1.0: 1 port detected
[ 5.600000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 5.610000] ohci-platform: OHCI generic platform driver
[ 5.620000] ohci-platform 101c1000.ohci: Generic Platform OHCI controller
[ 5.620000] ohci-platform 101c1000.ohci: new USB bus registered, assigned bus number 2
[ 5.630000] ohci-platform 101c1000.ohci: irq 26, io mem 0x101c1000
[ 5.700000] hub 2-0:1.0: USB hub found
[ 5.700000] hub 2-0:1.0: 1 port detected
[ 5.710000] usbcore: registered new interface driver usb-storage
[ 5.920000] usb 1-1: new high-speed USB device number 2 using ehci-platform
[ 6.070000] hub 1-1:1.0: USB hub found
[ 6.070000] hub 1-1:1.0: 4 ports detected
[ 6.570000] init: - preinit -
[ 7.140000] 8021q: adding VLAN 0 to HW filter on device eth0
[ 7.180000] mount_root: loading kmods from internal overlay
[ 7.680000] block: attempting to load /etc/config/fstab
[ 7.700000] block: extroot: not configured
[ 7.700000] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
[ 7.730000] procd: - early -
[ 7.740000] procd: - watchdog -
[ 8.460000] random: jshn urandom read with 14 bits of entropy available
[ 8.570000] procd: - ubus -
[ 9.580000] procd: - init -
Please press Enter to activate this console.
[ 11.460000] NET: Registered protocol family 10
[ 11.520000] ip6_tables: (C) 2000-2006 Netfilter Core Team
[ 11.560000] Linux video capture interface: v2.00
[ 11.570000] hidraw: raw HID events driver (C) Jiri Kosina
[ 11.640000] Bluetooth: Core ver 2.19
[ 11.640000] NET: Registered protocol family 31
[ 11.650000] Bluetooth: HCI device and connection manager initialized
[ 11.660000] Bluetooth: HCI socket layer initialized
[ 11.660000] Bluetooth: L2CAP socket layer initialized
[ 11.670000] Bluetooth: SCO socket layer initialized
[ 11.670000] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 11.680000] Bluetooth: BNEP filters: protocol multicast
[ 11.680000] Bluetooth: BNEP socket layer initialized
[ 11.690000] usbcore: registered new interface driver btusb
[ 11.700000] usbcore: registered new interface driver cdc_acm
[ 11.710000] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[ 11.720000] Loading modules backported from Linux version master-2015-03-09-0-g141f155
[ 11.720000] Backport generated by backports.git backports-20150129-0-gdd4a670
[ 11.730000] Bluetooth: HCI UART driver ver 2.2
[ 11.740000] Bluetooth: HCI H4 protocol initialized
[ 11.740000] Bluetooth: HCI BCSP protocol initialized
[ 11.750000] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[ 11.760000] Bluetooth: HIDP socket layer initialized
[ 11.760000] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 11.790000] nf_conntrack version 0.5.0 (960 buckets, 3840 max)
[ 11.810000] Bluetooth: RFCOMM TTY layer initialized
[ 11.820000] Bluetooth: RFCOMM socket layer initialized
[ 11.820000] Bluetooth: RFCOMM ver 1.11
[ 11.840000] usbcore: registered new interface driver ums-alauda
[ 11.840000] usbcore: registered new interface driver ums-cypress
[ 11.850000] usbcore: registered new interface driver ums-datafab
[ 11.860000] usbcore: registered new interface driver ums-freecom
[ 11.870000] usbcore: registered new interface driver ums-isd200
[ 11.880000] usbcore: registered new interface driver ums-jumpshot
[ 11.890000] usbcore: registered new interface driver ums-karma
[ 11.900000] usbcore: registered new interface driver ums-sddr09
[ 11.900000] usbcore: registered new interface driver ums-sddr55
[ 11.910000] usbcore: registered new interface driver ums-usbat
[ 11.920000] usbcore: registered new interface driver usbhid
[ 11.930000] usbhid: USB HID core driver
[ 11.940000] usbcore: registered new interface driver usbserial
[ 11.950000] usbcore: registered new interface driver usbserial_generic
[ 11.950000] usbserial: USB Serial support registered for generic
[ 11.970000] usbcore: registered new interface driver uvcvideo
[ 11.970000] USB Video Class driver (1.1.1)
[ 12.000000] xt_time: kernel timezone is -0000
[ 12.040000] cfg80211: Calling CRDA to update world regulatory domain
[ 12.040000] cfg80211: World regulatory domain updated:
[ 12.050000] cfg80211: DFS Master region: unset
[ 12.050000] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[ 12.060000] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 12.070000] cfg80211: (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 12.080000] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[ 12.090000] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[ 12.100000] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[ 12.110000] cfg80211: (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[ 12.110000] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[ 12.120000] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[ 12.130000] usbcore: registered new interface driver ch341
[ 12.140000] usbserial: USB Serial support registered for ch341-uart
[ 12.150000] usbcore: registered new interface driver ftdi_sio
[ 12.150000] usbserial: USB Serial support registered for FTDI USB Serial Device
[ 12.230000] usbcore: registered new interface driver pl2303
[ 12.240000] usbserial: USB Serial support registered for pl2303
[ 12.250000] PPP generic driver version 2.4.2
[ 12.260000] NET: Registered protocol family 24
[ 12.280000] usbcore: registered new interface driver snd-usb-audio
[ 12.300000] usbcore: registered new interface driver option
[ 12.300000] usbserial: USB Serial support registered for GSM modem (1-port)
[ 12.330000] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 5390, rev 0500 detected
[ 12.340000] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 7620 detected
[ 21.180000] 8021q: adding VLAN 0 to HW filter on device eth0
[ 26.380000] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[ 26.400000] jffs2_build_filesystem(): unlocking the mtd device... done.
[ 26.400000] jffs2_build_filesystem(): erasing all blocks after the end marker...
I can get a shell on the device fine over serial (and if I manually add to authorised_keys
I can SSH as root fine too with the LAN connection (also works with t2 root
)
@tanepiper I saw your message on Twitter, re: "simpleExec"—but I'm not sure what would cause that.
Digging and digging, I get as far as OutEndpoint.prototype.transfer
possibly not firing the callback, so _write never calls it when .end
is called at line 99 (proc.control.end(command)
) in usb-connection.js
Following up with my conversation with @rwaldron on Twitter (https://twitter.com/tanepiper/status/1358198339662151684?s=20) I wanted to create this ticket to ensure that I was able to record the debugging I've been doing to get this CLI working with the Tessel
tl;dr
The bug seems to be in
Tessel.prototype.simpleExec
which never resolves it's PromiseBackground
I've had the Tessel 2 board for a while now, but honestly, I could never get it to work and it sort of sat at the bottom of my cupboard for the last 5 years. Recently I've been working with Web Serial APIs and brought it out to see if I could get it working.
Currently, I am on OSX Big Sur 11.2 with
node v14.15.3
- but I also tried to see if I can get this working on Windows but no luck either.The Problem Description:
Whenever I try use the board CLI tool - if I have the device connected to USB only it never finds the device but for example if it's booting I do get a warning about a booting board.
If I plug it into the LAN, it's also seen - but the USB connection is never seen. I can confirm it's a valid USB cable however because I can see the serial connection details using https://webserial.app or t2-serial
Here is the board:
Discovery:
After some digging in to the code I what I thought to be the bug here that
Tessel.getName
never resolves as a promise because in my casethis.usbConnection.intf.altSetting === 2
for meBut after doing a bit more digging (now that it was returning some kind of device) I eventually found that here never completes - the 'finish' event is never fired.
The above command creates a string
touch/etc/dropbear/authorized_keys
(yes, without a space!) but even adding a space did nothing here, theproc.control.end(command);
doesn't seem to flush.This is really as far as I got - it seems it's in
RemoteWritableStream
where the problem lies (and would also explain the original problem of the name never returning for the USB connection since it also does anexec
call).