Comments (7)
Thanks for the info!
When attaching things seem ok except for:
00000146 163.32231140 usbip_stub:(EE) not supported:usbip_stub: stub_dispatch: IRP_MJ_WRITE: Enter
00000147 163.32231140 usbip_stub: dispatch_write: hdr: cmd:USBIP_CMD_UNLINK,seq:12,out,ep:0,unlinkseq:11
00000148 163.32231140 usbip_stub: process_cmd_unlink: enter
00000149 163.32235718 usbip_stub: stub_dispatch: IRP_MJ_READ: Enter
00000150 163.32235718 usbip_stub: dispatch_read: enter
00000151 163.32269287 usbip_stub: stub_dispatch: IRP_MJ_WRITE: Enter
00000152 163.32269287 usbip_stub: dispatch_write: hdr: cmd:USBIP_CMD_SUBMIT,seq:13,out,ep:0,tlen:0,intv:0
00000153 163.32270813 usbip_stub: control_transfer: seq:13, csp:out,BMREQUEST_VENDOR,BMREQUEST_TO_DEVICE,USB_REQUEST_SET_CONFIGURATION,wIndex:0,wLength:0,wValue:16
When I open screen on /dev/ttyUSB0 but type no characters I see this pattern quickly repeated:
00021990 261.18692017 usbip_stub: send_stub_res: partially sent: 0 < 2: seq:1587,data_len:2
00021991 261.18698120 usbip_stub: stub_dispatch: IRP_MJ_READ: Enter
00021992 261.18698120 usbip_stub: dispatch_read: enter
00021993 261.18701172 usbip_stub: send_stub_res: sent: cmd:USBIP_RET_SUBMIT,seq:1587,out,ep:0,alen:2
00021994 261.18713379 usbip_stub: stub_dispatch: IRP_MJ_READ: Enter
00021995 261.18713379 usbip_stub: dispatch_read: enter
00021996 261.18804932 usbip_stub: stub_dispatch: IRP_MJ_WRITE: Enter
00021997 261.18804932 usbip_stub: dispatch_write: hdr: cmd:USBIP_CMD_SUBMIT,seq:1589,in,ep:1,tlen:512,intv:0
00021998 261.18804932 usbip_stub: bulk_intr_transfer: seq:1589, ep:epaddr:81
00021999 261.18807983 usbip_stub: call_usbd_nb: enter
00022000 261.18807983 usbip_stub: call_usbd_nb: call_usbd_nb: seq:1589,data_len:512
00022001 261.18811035 usbip_stub: call_usbd_nb: status = STATUS_PENDING
00022002 261.20285034 usbip_stub: do_safe_completion: status = USBD_STATUS_SUCCESS
00022003 261.20288086 usbip_stub: done_bulk_intr_transfer: sres:seq:1588,data_len:512,status:STATUS_SUCCESS,usbd_status:USBD_STATUS_SUCCESS
I'll look into what "(EE) not supported" means to familiarize myself with what is going on.
Thanks,
Richard
from usbip-win.
Thanks! I've created a PR against master.
from usbip-win.
To check the problem of stub driver, windows kernel logs would be helpful. Please refer to #25 (comment)
from usbip-win.
I took a look at line 207 in stub_write.c and found:
case BMREQUEST_VENDOR:
DBGE(DBG_READWRITE, "not supported:", dbg_cspkt_reqtype(reqType));
break;
As an experiment I changed it to:
case BMREQUEST_VENDOR:
process_class_request(devstub, csp, hdr);
DBGE(DBG_READWRITE, "maybe supported:", dbg_cspkt_reqtype(reqType));
break;
and I got much further. In dmesg after attach I see:
[ 7733.596405] ftdi_sio 1-1:1.0: FTDI USB Serial Device converter detected
[ 7733.596437] usb 1-1: Detected FT232RL
[ 7733.597818] ftdi_sio ttyUSB0: Unable to read latency timer: -1
[ 7733.598888] ftdi_sio ttyUSB0: Unable to write latency timer: -1
[ 7733.599094] usb 1-1: FTDI USB Serial Device converter now attached to ttyUSB0
Now in screen I can send and receive on the FTDI device using the default baud rate. When the baud rate is changed however I get this in dmesg:
[ 7788.989553] ftdi_sio ttyUSB0: ftdi_set_termios FAILED to set databits/stopbits/parity
[ 7788.990295] ftdi_sio ttyUSB0: ftdi_set_termios urb failed to set baudrate
[ 7788.990954] ftdi_sio ttyUSB0: failed to set flow control: -1
[ 7788.992480] ftdi_sio ttyUSB0: failed to get modem status: -1
[ 7788.993173] ftdi_sio ttyUSB0: ftdi_set_termios urb failed to set baudrate
[ 7788.993848] ftdi_sio ttyUSB0: failed to set flow control: -1
[ 7788.994577] ftdi_sio ttyUSB0: failed to get modem status: -1
[ 7880.588650] ftdi_sio ttyUSB0: usb_serial_generic_read_bulk_callback - urb stopped: -32
It seems to me that the reason why this is not working is we are not handling BMREQUEST_VENDOR. Simply sending bad data to the device allows us to continue in a broken state but it's still progress. How would we go about adding proper support for this?
Thanks,
Richard
from usbip-win.
@rpasek : You're going well.. 😄 I guess that I had not implemented vendor request because I don't have such a device.. Treating vendor request seems to be much like class request. But process_class_request() should be slightly changed such as that URB_FUNCTION_CLASS_DEVICE -> URB_FUNCION_VENDOR_DEVICE.
Will you try this? I bet that you can make it!
from usbip-win.
Thanks! I attempted this earlier today and it works well! I don't have much experience using github but I have a branch I'd like to push and create a pull request for. Can you give me access to push a branch or should I fork and then inform you of the branch?
If not here is the code I changed:
static void
process_class_request(usbip_stub_dev_t *devstub, usb_cspkt_t *csp, struct usbip_header *hdr, BOOLEAN vendorreq)
{
PVOID data;
ULONG datalen;
USHORT cmd;
UCHAR reservedBits;
unsigned long seqnum;
BOOLEAN is_in, res;
datalen = hdr->u.cmd_submit.transfer_buffer_length;
if (datalen == 0)
data = NULL;
else
data = (PVOID)(hdr + 1);
is_in = csp->bmRequestType.Dir ? TRUE : FALSE;
switch (csp->bmRequestType.Recipient) {
case BMREQUEST_TO_DEVICE:
cmd = vendorreq ? URB_FUNCTION_VENDOR_DEVICE : URB_FUNCTION_CLASS_DEVICE;
break;
case BMREQUEST_TO_INTERFACE:
cmd = vendorreq ? URB_FUNCTION_VENDOR_INTERFACE : URB_FUNCTION_CLASS_INTERFACE;
break;
case BMREQUEST_TO_ENDPOINT:
cmd = vendorreq ? URB_FUNCTION_VENDOR_ENDPOINT : URB_FUNCTION_CLASS_ENDPOINT;
break;
default:
cmd = vendorreq ? URB_FUNCTION_VENDOR_OTHER : URB_FUNCTION_CLASS_OTHER;
break;
}
reservedBits = csp->bmRequestType.Reserved;
seqnum = hdr->base.seqnum;
res = submit_class_vendor_req(devstub, is_in, cmd, reservedBits, csp->bRequest, csp->wValue.W, csp->wIndex.W, data, &datalen);
if (res) {
if (is_in)
reply_stub_req_data(devstub, seqnum, data, datalen, TRUE);
else
reply_stub_req_hdr(devstub, USBIP_RET_SUBMIT, seqnum);
}
else
reply_stub_req_err(devstub, USBIP_RET_SUBMIT, seqnum, -1);
}
static void
process_control_transfer(usbip_stub_dev_t *devstub, struct usbip_header *hdr)
{
usb_cspkt_t *csp;
UCHAR reqType;
csp = (usb_cspkt_t *)hdr->u.cmd_submit.setup;
DBGI(DBG_READWRITE, "control_transfer: seq:%u, csp:%s\n", hdr->base.seqnum, dbg_ctlsetup_packet(csp));
reqType = CSPKT_REQUEST_TYPE(csp);
switch (reqType) {
case BMREQUEST_STANDARD:
process_standard_request(devstub, hdr->base.seqnum, csp);
break;
case BMREQUEST_CLASS:
process_class_request(devstub, csp, hdr, FALSE);
break;
case BMREQUEST_VENDOR:
process_class_request(devstub, csp, hdr, TRUE);
break;
default:
DBGE(DBG_READWRITE, "invalid request type:", dbg_cspkt_reqtype(reqType));
break;
}
}
from usbip-win.
@rpasek :
Can you give me access to push a branch or should I fork and then inform you of the branch?
Both would be fine. I added you as collaborator. You can create a branch or commit to existing branch.
from usbip-win.
Related Issues (20)
- About debug in VS2019
- USB microphone does not work (does not transmit a signal). USB flash works
- Attaching remote device by VID rather than BUS ID HOT 6
- is it possible to use usbip inside a remote desktop session together with a wacom tablet?
- failed to attach, code:-6 HOT 1
- usbip:error:attacher.exe not found
- Device shows up on client, but stops working after attached HOT 1
- Xbox Wireless Adapter for Windows Attaches but unable to associate controller HOT 11
- python hid.py usbip.py
- Driver signing / Microsoft
- Merge in upstream?
- Confused about the notes on release usbip-win 0.3.6-dev HOT 1
- Unable to Bind More Than 12 USB Devices Using USB IP Solution
- Device from Linux server on Windows client disconnects after 3 seconds
- USBIP error on attach with: usbip: error: failed to attach on client and usbipd: info: request 0x8003(5): failed on server
- Camera issues HOT 3
- Device is "Unstably bound"
- UDE Driver conflicts with Parsec's Virtual USB device driver
- swiotlb buffer is full (sz: 524288 bytes), total 32768 (slots), used 4 (slots)
- connected device is not realy connected (W11 / 24H2) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from usbip-win.