Skip to content

Commit 82f1e47

Browse files
committed
usbd: Use EP_IN_FLAG from utils for mass storage
1 parent e85b368 commit 82f1e47

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

micropython/usbd/msc.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
split_bmRequestType,
88
STAGE_SETUP,
99
REQ_TYPE_CLASS,
10+
EP_IN_FLAG
1011
)
1112
from micropython import const
1213
import micropython
@@ -23,9 +24,6 @@
2324
_MASS_STORAGE_RESET_REQUEST = const(0xFF)
2425
_GET_MAX_LUN_REQUEST = const(0xFE)
2526

26-
EP_IN_FLAG = const(1 << 7)
27-
EP_OUT_FLAG = const(0x7F)
28-
2927

3028
class CBW:
3129
"""Command Block Wrapper - handles the incoming data from the host to the device"""
@@ -179,7 +177,7 @@ def get_endpoint_descriptors(self, ep_addr, str_idx):
179177
self.log(f"MSC: get_endpoint_descriptors, {ep_addr}, {str_idx}")
180178
# The OUT endpoint is from host to device, and has the top bit set to 0
181179
# The IN endpoint is from device to host, and has the top bit set to 1
182-
self.ep_out = ep_addr & EP_OUT_FLAG
180+
self.ep_out = ep_addr & ~EP_IN_FLAG
183181
self.ep_in = (ep_addr + 1) | EP_IN_FLAG
184182
e_out = endpoint_descriptor(self.ep_out, "bulk", _MAX_PACKET_SIZE)
185183
e_in = endpoint_descriptor(self.ep_in, "bulk", _MAX_PACKET_SIZE)

0 commit comments

Comments
 (0)