Skip to content

Commit

Permalink
Merge branch 'main' into recv_into_size_check
Browse files Browse the repository at this point in the history
  • Loading branch information
gamblor21 authored Oct 16, 2020
2 parents 645382d + f0b3731 commit 8e6d3e5
Show file tree
Hide file tree
Showing 144 changed files with 3,310 additions and 1,443 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: CircuitPython version
run: |
git describe --dirty --tags
echo "::set-env name=CP_VERSION::$(git describe --dirty --tags)"
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
- name: Install dependencies
run: |
brew install gettext awscli
echo "::set-env name=PATH::/usr/local/opt/gettext/bin:$PATH"
echo >>$GITHUB_PATH /usr/local/opt/gettext/bin
- name: Versions
run: |
gcc --version
Expand All @@ -146,7 +146,7 @@ jobs:
- name: CircuitPython version
run: |
git describe --dirty --tags
echo "::set-env name=CP_VERSION::$(git describe --dirty --tags)"
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
- name: Build mpy-cross
run: make -C mpy-cross -j2
- uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -180,6 +180,7 @@ jobs:
- "arduino_zero"
- "bast_pro_mini_m0"
- "bdmicro_vina_d21"
- "bdmicro_vina_d51"
- "bless_dev_board_multi_sensor"
- "blm_badge"
- "capablerobot_usbhub"
Expand All @@ -197,6 +198,8 @@ jobs:
- "datum_imu"
- "datum_light"
- "datum_weather"
- "dynossat_edu_eps"
- "dynossat_edu_obc"
- "electronut_labs_blip"
- "electronut_labs_papyr"
- "escornabot_makech"
Expand Down Expand Up @@ -243,6 +246,7 @@ jobs:
- "metro_m0_express"
- "metro_m4_airlift_lite"
- "metro_m4_express"
- "metro_m7_1011"
- "metro_nrf52840_express"
- "mini_sam_m4"
- "monster_m4sk"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
- name: set PY
run: echo "::set-env name=PY::$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')"
run: echo >>$GITHUB_ENV PY="$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')"
- uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,4 @@
url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git
[submodule "ports/esp32s2/esp-idf"]
path = ports/esp32s2/esp-idf
url = https://github.com/hierophect/esp-idf.git
url = https://github.com/espressif/esp-idf.git
1 change: 0 additions & 1 deletion devices/ble_hci/common-hal/_bleio/Adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include "shared-bindings/_bleio/Address.h"
#include "shared-bindings/_bleio/Characteristic.h"
#include "shared-bindings/_bleio/Service.h"
#include "shared-bindings/nvm/ByteArray.h"
#include "shared-bindings/_bleio/Connection.h"
#include "shared-bindings/_bleio/ScanEntry.h"
#include "shared-bindings/time/__init__.h"
Expand Down
2 changes: 1 addition & 1 deletion devices/ble_hci/common-hal/_bleio/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ bleio_adapter_obj_t *common_hal_bleio_allocate_adapter_or_raise(void) {

void common_hal_bleio_check_connected(uint16_t conn_handle) {
if (conn_handle == BLE_CONN_HANDLE_INVALID) {
mp_raise_bleio_ConnectionError(translate("Not connected"));
mp_raise_ConnectionError(translate("Not connected"));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include <stdbool.h>
// for __packed
#include <string.h>
#include <sys/cdefs.h>

#define BT_EATT_PSM 0x27
#define BT_ATT_DEFAULT_LE_MTU 23
Expand Down
7 changes: 6 additions & 1 deletion devices/ble_hci/common-hal/_bleio/hci_include/hci.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@
#define ZEPHYR_INCLUDE_BLUETOOTH_HCI_H_

#include <stdbool.h>
#include <string.h>
// for __packed
#include <sys/cdefs.h>

#include "addr.h"

// ESP32S2 build environment defines this already.
#ifndef BIT
#define BIT(n) (1UL << (n))
#endif

/* Special own address types for LL privacy (used in adv & scan parameters) */
#define BT_HCI_OWN_ADDR_RPA_OR_PUBLIC 0x02
Expand Down
37 changes: 25 additions & 12 deletions extmod/vfs_fat_diskio.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ DRESULT disk_write (

DRESULT disk_ioctl (
bdev_t pdrv, /* Physical drive nmuber (0..) */
BYTE cmd, /* Control code */
BYTE cmd, /* Control code */
void *buff /* Buffer to send/receive control data */
)
{
Expand All @@ -133,7 +133,7 @@ DRESULT disk_ioctl (
}

// First part: call the relevant method of the underlying block device
mp_obj_t ret = mp_const_none;
mp_int_t out_value = 0;
if (vfs->flags & FSUSER_HAVE_IOCTL) {
// new protocol with ioctl
static const uint8_t op_map[8] = {
Expand All @@ -144,9 +144,19 @@ DRESULT disk_ioctl (
};
uint8_t bp_op = op_map[cmd & 7];
if (bp_op != 0) {
vfs->u.ioctl[2] = MP_OBJ_NEW_SMALL_INT(bp_op);
vfs->u.ioctl[3] = MP_OBJ_NEW_SMALL_INT(0); // unused
ret = mp_call_method_n_kw(2, 0, vfs->u.ioctl);
if (vfs->flags & FSUSER_NATIVE) {
bool (*f)(size_t, mp_int_t*) = (void*)(uintptr_t)vfs->u.ioctl[2];
if (!f(bp_op, (mp_int_t*) &out_value)) {
return RES_ERROR;
}
} else {
vfs->u.ioctl[2] = MP_OBJ_NEW_SMALL_INT(bp_op);
vfs->u.ioctl[3] = MP_OBJ_NEW_SMALL_INT(0); // unused
mp_obj_t ret = mp_call_method_n_kw(2, 0, vfs->u.ioctl);
if (ret != mp_const_none) {
out_value = mp_obj_get_int(ret);
}
}
}
} else {
// old protocol with sync and count
Expand All @@ -157,10 +167,13 @@ DRESULT disk_ioctl (
}
break;

case GET_SECTOR_COUNT:
ret = mp_call_method_n_kw(0, 0, vfs->u.old.count);
case GET_SECTOR_COUNT: {
mp_obj_t ret = mp_call_method_n_kw(0, 0, vfs->u.old.count);
if (ret != mp_const_none) {
out_value = mp_obj_get_int(ret);
}
break;

}
case GET_SECTOR_SIZE:
// old protocol has fixed sector size of 512 bytes
break;
Expand All @@ -177,16 +190,16 @@ DRESULT disk_ioctl (
return RES_OK;

case GET_SECTOR_COUNT: {
*((DWORD*)buff) = mp_obj_get_int(ret);
*((DWORD*)buff) = out_value;
return RES_OK;
}

case GET_SECTOR_SIZE: {
if (ret == mp_const_none) {
if (out_value == 0) {
// Default sector size
*((WORD*)buff) = 512;
} else {
*((WORD*)buff) = mp_obj_get_int(ret);
*((WORD*)buff) = out_value;
}
#if _MAX_SS != _MIN_SS
// need to store ssize because we use it in disk_read/disk_write
Expand All @@ -202,7 +215,7 @@ DRESULT disk_ioctl (
case IOCTL_INIT:
case IOCTL_STATUS: {
DSTATUS stat;
if (ret != mp_const_none && MP_OBJ_SMALL_INT_VALUE(ret) != 0) {
if (out_value != 0) {
// error initialising
stat = STA_NOINIT;
} else if (vfs->writeblocks[0] == MP_OBJ_NULL) {
Expand Down
Loading

0 comments on commit 8e6d3e5

Please sign in to comment.