Skip to content

Commit 6694e76

Browse files
committed
Fix sample testplan
Cleanup sample.yaml file Signed-off-by: Mohamed ElShahawi <[email protected]>
1 parent 02a2fb9 commit 6694e76

File tree

2 files changed

+9
-51
lines changed

2 files changed

+9
-51
lines changed

samples/subsys/usb/mtp/sample.yaml

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,11 @@
11
sample:
2-
name: MTP USB
2+
name: USB MTP device class sample
33
tests:
4-
sample.usb.mtp:
5-
depends_on: usb_device
6-
tags: usb
7-
arch_exclude: posix
8-
harness: console
9-
harness_config:
10-
type: one_line
11-
regex:
12-
- "Wait for DTR"
134
sample.usb_device_next.mtp:
145
depends_on: usbd
156
tags: usb
16-
extra_args: CONF_FILE="usbd_next_prj.conf"
17-
integration_platforms:
18-
- nrf52840dk/nrf52840
19-
- nrf54h20dk/nrf54h20/cpuapp
20-
- frdm_k64f
21-
- stm32f723e_disco
22-
- nucleo_f413zh
23-
- mimxrt685_evk/mimxrt685s/cm33
24-
- mimxrt1060_evk
257
harness: console
268
harness_config:
279
type: one_line
2810
regex:
29-
- "Wait for DTR"
30-
sample.usb.mtp.buildonly:
31-
depends_on: usb_device
32-
tags: usb
33-
arch_allow: posix
34-
build_only: true
35-
integration_platforms:
36-
- native_sim
11+
- "USB device support enabled"

samples/subsys/usb/mtp/src/main.c

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
#include <zephyr/logging/log.h>
2222
LOG_MODULE_REGISTER(usb_mtp_sample, LOG_LEVEL_INF);
2323

24-
static struct usbd_context *sample_usbd;
25-
2624
static void sample_msg_cb(struct usbd_context *const ctx, const struct usbd_msg *msg)
2725
{
2826
LOG_INF("USBD message: %s", usbd_msg_type_string(msg->type));
@@ -42,36 +40,21 @@ static void sample_msg_cb(struct usbd_context *const ctx, const struct usbd_msg
4240
}
4341
}
4442

45-
static int enable_usb_device_next(void)
43+
int main(void)
4644
{
47-
int err;
45+
struct usbd_context *sample_usbd;
4846

4947
sample_usbd = sample_usbd_init_device(sample_msg_cb);
5048
if (sample_usbd == NULL) {
5149
LOG_ERR("Failed to initialize USB device");
52-
return -ENODEV;
50+
return -1;
5351
}
5452

55-
if (!usbd_can_detect_vbus(sample_usbd)) {
56-
err = usbd_enable(sample_usbd);
57-
if (err) {
58-
LOG_ERR("Failed to enable device support");
59-
return err;
60-
}
53+
if (usbd_enable(sample_usbd)) {
54+
LOG_ERR("Failed to enable device support");
55+
return -1;
6156
}
6257

63-
LOG_INF("USB device support enabled");
64-
65-
return 0;
66-
}
67-
68-
int main(void)
69-
{
70-
int ret;
71-
#if defined(CONFIG_USB_DEVICE_STACK_NEXT)
72-
ret = enable_usb_device_next();
73-
#else
74-
#error "Only Device next is supported"
75-
#endif
58+
LOG_INF("USB device support enabled\n");
7659
return 0;
7760
}

0 commit comments

Comments
 (0)