简体   繁体   English

QNX上的USB大容量存储文件系统位置

[英]Usb mass storage file system location on QNX

I need my software to be notifed that usb mass storage stick has been inserterd, also i need locationa where this stick has been mounted. 我需要通知我的软件,表明已插入USB大容量存储棒,也需要安装该棒的locationa。 Is it possible to obtain this information, especially location on fs where stick has been mounted from any C library ? 是否有可能获得此信息,尤其是从任何C库中已安装Stick的fs上的位置?

For instertion i already know usbd_connect() and i'm using it. 我已经知道了usbd_connect()并正在使用它。 Unfortunatelly there is no information with respect to location on fs. 不幸的是,没有关于fs位置的信息。

regards JosiP 问候乔西

io-usb should be up and running on your target. io-usb应该已启动并在目标上运行。

Add the library "usbdi" to your project. 将库“ usbdi”添加到您的项目。

Then use the following code snipet : 然后使用以下代码snipet:

#include <sys/usbdi.h>

static struct usbd_connection *conn_usb = NULL;
static void cbinsert(struct usbd_connection *connection, usbd_device_instance_t *ins);
static void cbremove(struct usbd_connection *connection, usbd_device_instance_t *ins);

        int init(void)
        {
            usbd_funcs_t funcs = { _USBDI_NFUNCS, cbinsert, cbremove, NULL };
            usbd_connect_parm_t parm = {NULL, USB_VERSION, USBD_VERSION, 0, 0, NULL, 0, NULL,  &funcs,0};

            if (usbd_connect(&parm, &conn_usb) != EOK) {
                /* write your own error handler */
            }

And then, add your customized handler : 然后,添加您的自定义处理程序:

static void cbinsert(struct usbd_connection *usb_connection,usbd_device_instance_t *usb_instance)
{
    if (usb_instance->ident.dclass == 8 && usb_instance->ident.subclass == 6) {
        /* USB mass storage */
    } else if (usb_instance->ident.dclass == 3 && usb_instance->ident.subclass == 1) {
        /* USB mouse */
    } else {
        /* unknown device */
    }

This is an example. 这是一个例子。 You will have to customized it. 您将必须对其进行自定义。 But everything you need is there. 但是您所需的一切都在那里。

Hope this help ! 希望对您有所帮助! Emmanuel 伊曼纽尔

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM