10000 Enable* web workflow for Pico W by tannewt · Pull Request #7247 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

Enable* web workflow for Pico W #7247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ports/atmel-samd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ SRC_C += \
boards/$(BOARD)/board.c \
boards/$(BOARD)/pins.c \
eic_handler.c \
fatfs_port.c \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you just say a few words about what's going on with this removal?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it from each port because the implementation was the same or worse. Now there is a shared implementation in supervisor/. I did this here because workflows use an override_fattime call to set the file modification time based on the API transaction's time rather than the internal RTC.

lib/tinyusb/src/portable/microchip/samd/dcd_samd.c \
mphalport.c \
reset.c \
Expand Down
48 changes: 0 additions & 48 deletions ports/atmel-samd/fatfs_port.c

This file was deleted.

1 change: 0 additions & 1 deletion ports/broadcom/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ SRC_C += bindings/videocore/__init__.c \
boards/$(BOARD)/pins.c \
background.c \
common-hal/videocore/Framebuffer.c \
fatfs_port.c \
mphalport.c \
lib/sdmmc/sdmmc_cmd.c \
lib/sdmmc/sdmmc_common.c \
Expand Down
48 changes: 0 additions & 48 deletions ports/broadcom/fatfs_port.c

This file was deleted.

1 change: 0 additions & 1 deletion ports/cxd56/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ SRC_S = supervisor/cpu.s

SRC_C += \
background.c \
fatfs_port.c \
mphalport.c \
boards/$(BOARD)/board.c \
boards/$(BOARD)/pins.c \
Expand Down
46 changes: 0 additions & 46 deletions ports/cxd56/fatfs_port.c

This file was deleted.

1 change: 0 additions & 1 deletion ports/espressif/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ endif

SRC_C += \
background.c \
fatfs_port.c \
mphalport.c \
bindings/espidf/__init__.c \
boards/$(BOARD)/board.c \
Expand Down
41 changes: 39 additions & 2 deletions ports/espressif/common-hal/socketpool/Socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ socketpool_socket_obj_t *common_hal_socketpool_socket(socketpool_socketpool_obj_
return sock;
}

int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port) {
int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port, socketpool_socket_obj_t *accepted) {
struct sockaddr_in accept_addr;
socklen_t socklen = sizeof(accept_addr);
int newsoc = -1;
Expand Down Expand Up @@ -274,12 +274,25 @@ int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_
lwip_close(newsoc);
return -MP_EBADF;
}


if (accepted != NULL) {
// Close the active socket because we have another we accepted.
if (!common_hal_socketpool_socket_get_closed(accepted)) {
common_hal_socketpool_socket_close(accepted);
}
// Create the socket
accepted->num = newsoc;
accepted->pool = self->pool;
accepted->connected = true;
}

return newsoc;
}

socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_obj_t *self,
uint8_t *ip, uint32_t *port) {
int newsoc = socketpool_socket_accept(self, ip, port);
int newsoc = socketpool_socket_accept(self, ip, port, NULL);

if (newsoc > 0) {
mark_user_socket(newsoc);
Expand Down Expand Up @@ -554,6 +567,15 @@ void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t *self, uint
self->timeout_ms = timeout_ms;
}


int common_hal_socketpool_socket_setsockopt(socketpool_socket_obj_t *self, int level, int optname, const void *value, size_t optlen) {
int err = lwip_setsockopt(self->num, level, optname, value, optlen);
if (err != 0) {
return -errno;
}
return 0;
}

bool common_hal_socketpool_readable(socketpool_socket_obj_t *self) {
struct timeval immediate = {0, 0};

Expand All @@ -577,3 +599,18 @@ bool common_hal_socketpool_writable(socketpool_socket_obj_t *self) {
// including returning true in the error case
return num_triggered != 0;
}

void socketpool_socket_move(socketpool_socket_obj_t *self, socketpool_socket_obj_t *sock) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the invariant here that the "sock" socket is guaranteed not open, so that it doesn't need to be closed or otherwise operated on?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that should be true. I'll add a check just in case. (Maybe you could get a second websocket request at the same time the first is open.)

*sock = *self;
self->connected = false;
self->num = -1;
}

void socketpool_socket_reset(socketpool_socket_obj_t *self) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need to close the underlying socket, or is the invariant that the underlying socket is already always closed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should have never been used. This is really to set the memory so it reads as closed before it is used. Happy to rename if you have a better name suggestion.

if (self->base.type == &socketpool_socket_type) {
return;
}
self->base.type = &socketpool_socket_type;
self->connected = false;
self->num = -1;
}
51 changes: 0 additions & 51 deletions ports/espressif/fatfs_port.c

This file was deleted.

1 change: 0 additions & 1 deletion ports/litex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_VALENTYUSB_EPTRI -DCFG_TUD_CDC_RX_BUFSIZE=1024

SRC_C += \
background.c \
fatfs_port.c \
mphalport.c \
boards/$(BOARD)/board.c \
boards/$(BOARD)/pins.c
Expand Down
33 changes: 0 additions & 33 deletions ports/litex/fatfs_port.c

This file was deleted.

1 change: 0 additions & 1 deletion ports/mimxrt10xx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ SRC_C += \
boards/$(BOARD)/board.c \
boards/$(BOARD)/flash_config.c \
boards/$(BOARD)/pins.c \
fatfs_port.c \
lib/tinyusb/src/portable/chipidea/ci_hs/dcd_ci_hs.c \
mphalport.c \
peripherals/mimxrt10xx/$(CHIP_FAMILY)/clocks.c \
Expand Down
48 changes: 0 additions & 48 deletions ports/mimxrt10xx/fatfs_port.c

This file was deleted.

Loading
0