Porównaj commity

...

11 Commity

Autor SHA1 Wiadomość Data
Ilan Schemoul c131765a8a
Merge branch 'master' into master 2024-03-18 01:50:35 +01:00
Dave Hylands c8a2cd7d20
Merge pull request #224 from Its-Just-Nans/check-dir
Check dir before listing - handle NotADirectoryError
2024-02-04 14:11:41 -08:00
n4n5 95a5a97364
feat: check dir before listing 2024-01-30 11:24:19 +01:00
Dave Hylands 6b80fbe1d4 Updated twine make rules 2024-01-29 06:53:11 -08:00
Dave Hylands 624d5b1e3f Cleaned up directories for littlefs filesystems
- bumped version to 0.0.32
2024-01-20 10:34:41 -08:00
Dave Hylands bfacb5b6e2 Several fixes
- Now detects Xiao EPS32C3
- Set Pico buffer size to 32
- Fixed timezone adjustment for Pico
- No longer tries telnet if port contains a /
2024-01-19 21:01:29 -08:00
Dave Hylands b87878c01a
Merge pull request #186 from ironss-iotec/long-port-name
Catch exception raised by socket.gethostbyname() if the serial port name is too long
2022-05-18 10:11:57 -07:00
Stephen Irons ed0fa07f48 Catch exception raised by socket.gethostbyname() if the serial port name is too long. 2022-05-18 15:21:22 +12:00
Dave Hylands 76ccf58fec
Merge pull request #181 from jerryneedell/jerryn_binascii
import binascii if ubinascii not found

- Thanks for the PR
2022-04-12 16:05:59 -07:00
jerryneedell 98a2a6e997 import binascii if ubinascii not found 2022-03-21 06:25:06 -04:00
Dave Hylands b0acaafa74 Fixed BUFFER_SIZE when using USB based device
Changed RPI pico default buffer size to 32
Bumped version to 0.0.31
2021-12-30 10:40:10 -08:00
3 zmienionych plików z 50 dodań i 24 usunięć

Wyświetl plik

@ -1,3 +1,7 @@
#
# Note: My setup uses the username/password stored in the ~/.pypirc file
#
test:
./tests/test-rshell.sh
@ -5,23 +9,18 @@ test:
sdist:
python3 setup.py sdist
# Registers this package on the pypi test server
register-test:
python3 setup.py register -r pypitest
# Creates the distribution tarball and uploads to the pypi test server
upload-test:
rm -rf dist/*
python3 setup.py sdist
twine upload -u dhylands --repository-url https://test.pypi.org/legacy/ dist/*
twine upload -r testpypi dist/*
# Creates the distribution tarball and uploads to the pypi live server
upload:
#python3 setup.py sdist upload -r pypi
rm -rf dist/*
python3 setup.py sdist
twine upload -u dhylands dist/*
twine upload -r pypi dist/*
# Registers this package on the pypi live server
register:
python3 setup.py register -r pypi
requirements:
pip install -r requirements.txt

Wyświetl plik

@ -227,6 +227,7 @@ def num_devices():
def is_micropython_usb_device(port):
"""Checks a USB device to see if it looks like a MicroPython device.
"""
global USB_BUFFER_SIZE
if type(port).__name__ == 'Device':
# Assume its a pyudev.device.Device
if ('ID_BUS' not in port or port['ID_BUS'] != 'usb' or
@ -242,9 +243,12 @@ def is_micropython_usb_device(port):
return True
# Check Raspberry Pi Pico
if usb_id.startswith('usb vid:pid=2e8a:0005'):
global USB_BUFFER_SIZE
USB_BUFFER_SIZE = RPI_PICO_USB_BUFFER_SIZE
return True
# Check for XIAO ESP32S3
if usb_id.startswith('usb vid:pid=303a:4001'):
USB_BUFFER_SIZE = 256
return True
# Check for Teensy VID:PID
if usb_id.startswith('usb vid:pid=16c0:0483'):
return True
@ -325,9 +329,9 @@ def autoscan():
"""autoscan will check all of the serial ports to see if they have
a matching VID:PID for a MicroPython board.
"""
global BUFFER_SIZE
for port in serial.tools.list_ports.comports():
if is_micropython_usb_device(port):
global BUFFER_SIZE
BUFFER_SIZE = USB_BUFFER_SIZE
connect_serial(port[0])
@ -742,6 +746,11 @@ def lstat(filename):
rstat = os.lstat(filename)
except:
rstat = os.stat(filename)
if rstat[0] & 0x4000 != 0 and rstat[8] == 0:
# littlefs does some funky stuff with the size field and directories.
# For now, we just set the size to 0.
# unreasonable.
rstat = rstat[:6] + tuple([0]) + rstat[7:]
return rstat[:7] + tuple(tim + TIME_OFFSET for tim in rstat[7:])
@ -821,6 +830,8 @@ def listdir_matches(match):
# This can happen when a symlink points to a non-existant file.
pass
return filename
if not os.path.isdir(dirname):
return []
matches = [add_suffix_if_dir(result_prefix + filename)
for filename in os.listdir(dirname) if filename.startswith(match_prefix)]
return matches
@ -1072,7 +1083,10 @@ def set_time(rtc_time):
def recv_file_from_host(src_file, dst_filename, filesize, dst_mode='wb'):
"""Function which runs on the pyboard. Matches up with send_file_to_remote."""
import sys
import ubinascii
try:
import ubinascii
except:
import binascii as ubinascii
import os
if HAS_BUFFER:
try:
@ -1184,7 +1198,10 @@ def recv_file_from_remote(dev, src_filename, dst_file, filesize):
def send_file_to_host(src_filename, dst_file, filesize):
"""Function which runs on the pyboard. Matches up with recv_file_from_remote."""
import sys
import ubinascii
try:
import ubinascii
except:
import binascii as ubinascii
try:
with open(src_filename, 'rb') as src_file:
bytes_remaining = filesize
@ -1235,7 +1252,10 @@ def test_readinto():
def test_unhexlify():
"""Checks the micropython firmware to see if ubinascii.unhexlify exists."""
import ubinascii
try:
import ubinascii
except:
import binascii as ubinascii
try:
_ = ubinascii.unhexlify
return True
@ -1379,14 +1399,17 @@ def add_arg(*args, **kwargs):
def connect(port, baud=115200, user='micro', password='python', wait=0):
"""Tries to connect automagically via network or serial."""
try:
ip_address = socket.gethostbyname(port)
#print('Connecting to ip', ip_address)
connect_telnet(port, ip_address, user=user, password=password)
except socket.gaierror:
# Doesn't look like a hostname or IP-address, assume its a serial port
#print('connecting to serial', port)
if '/' in port:
connect_serial(port, baud=baud, wait=wait)
else:
try:
ip_address = socket.gethostbyname(port)
#print('Connecting to ip', ip_address)
connect_telnet(port, ip_address, user=user, password=password)
except (socket.gaierror, ValueError):
# Doesn't look like a hostname or IP-address, assume its a serial port
#print('connecting to serial', port)
connect_serial(port, baud=baud, wait=wait)
def connect_telnet(name, ip_address=None, user='micro', password='python'):
@ -1528,8 +1551,12 @@ class Device(object):
self.time_offset = calendar.timegm(epoch_tuple)
# The pyboard maintains its time as localtime, whereas unix and
# esp32 maintain their time as GMT
self.adjust_for_timezone = (epoch_tuple[0] != 1970)
# esp32 maintain their time as GMT.
if self.sysname == 'rp2':
# The Pico uses a 1970 epoch, but uses localtime
self.adjust_for_timezone = True
else:
self.adjust_for_timezone = (epoch_tuple[0] != 1970)
def check_pyb(self):

Wyświetl plik

@ -1 +1 @@
__version__ = '0.0.30'
__version__ = '0.0.32'