Re: Understanding how USB transmission works

2020-03-02 Thread Farhan Khan
On Mon, Mar 2, 2020, at 4:48 PM, Hans Petter Selasky wrote:
> On 2020-03-02 22:19, Farhan Khan wrote:
> > Hi all,
> > 
> > I am trying to understand how FreeBSD's usb transfers work compared to 
> > OpenBSD by using the rum(4) driver. I am a little confused how the FreeBSD 
> > side works.
> 
> In FreeBSD USB transfers are a statemachine. In the beginning you call 
> the start method, and that invokes the statemachine callback in the 
> SETUP state. There you setup all parameters, buffers, lengths etc. and 
> then you can submit the USB transfer, which invoke the host controller 
> drivers routines, which actually lay out the required DMA descriptors 
> for data transfer. When the USB transfer is completed the statemachine 
> callback is invoked again and you can choose what to do.
> 
> --HPS
> 

Thank you so much for your prompt response! I understand that you are the one 
who wrote the USB stack? If so, I am honored.
Can you please clarify a few points you made?
> In the beginning you call the start method
Within rum(4), would that be rum_start()? If not, which function is that?

> then you can submit the USB transfer
Would that function be usbd_transfer_submit(9)?

Thanks again!
--
Farhan Khan
PGP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE

___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: Understanding how USB transmission works

2020-03-02 Thread Hans Petter Selasky

On 2020-03-02 22:19, Farhan Khan wrote:

Hi all,

I am trying to understand how FreeBSD's usb transfers work compared to OpenBSD 
by using the rum(4) driver. I am a little confused how the FreeBSD side works.


In FreeBSD USB transfers are a statemachine. In the beginning you call 
the start method, and that invokes the statemachine callback in the 
SETUP state. There you setup all parameters, buffers, lengths etc. and 
then you can submit the USB transfer, which invoke the host controller 
drivers routines, which actually lay out the required DMA descriptors 
for data transfer. When the USB transfer is completed the statemachine 
callback is invoked again and you can choose what to do.


--HPS



On the OpenBSD side, it seems that after allocating the pipes, you use 
usbd_setup_xfer and usbd_transfer(). As an example, look at OpenBSD's 
/usr/src/sys/dev/usb/if_rum.c, starting on line 2027-2029, I believe that 
corresponds to FreeBSD's /usr/src/sys/dev/usb/wlan/if_rum.c, line 2607 
(rum_setup_tx_list) which goes to 807. In this function, I see that it adds 
rum_tx_data (tx_data[i] to the end of tx_free. However, how does it actually 
send the data? I believe this occurs in the callback functions, specifically 
with the usbd_transfer_submit function, but I am not certain how that is 
triggered, especially when it is triggered by the driver, such as in a send 
function.





Please assist.
Thank you!

Links below to make it easy to follow:
OpenBSD:
https://github.com/openbsd/src/blob/2e342c845e9966c26657b08851237fc18e7b5ff5/sys/dev/usb/if_rum.c#L2024

FreeBSD:
1. 
https://github.com/freebsd/freebsd/blob/499b2b565264824f2139ebcb5d1c97404a17e7e6/sys/dev/usb/wlan/if_rum.c#L2607
2. 
https://github.com/freebsd/freebsd/blob/499b2b565264824f2139ebcb5d1c97404a17e7e6/sys/dev/usb/wlan/if_rum.c#L807

--
Farhan Khan
PGP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE

___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"



___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: Understanding how USB transmission works

2020-03-02 Thread Ian Lepore
On Mon, 2020-03-02 at 16:19 -0500, Farhan Khan wrote:
> Hi all,
> 
> I am trying to understand how FreeBSD's usb transfers work compared
> to OpenBSD by using the rum(4) driver. I am a little confused how the
> FreeBSD side works.
> 
> On the OpenBSD side, it seems that after allocating the pipes, you
> use usbd_setup_xfer and usbd_transfer(). As an example, look at
> OpenBSD's /usr/src/sys/dev/usb/if_rum.c, starting on line 2027-2029,
> I believe that corresponds to FreeBSD's
> /usr/src/sys/dev/usb/wlan/if_rum.c, line 2607 (rum_setup_tx_list)
> which goes to 807. In this function, I see that it adds rum_tx_data
> (tx_data[i] to the end of tx_free. However, how does it actually send
> the data? I believe this occurs in the callback functions,
> specifically with the usbd_transfer_submit function, but I am not
> certain how that is triggered, especially when it is triggered by the
> driver, such as in a send function.
> 
> Please assist.
> Thank you!
> 
> Links below to make it easy to follow:
> OpenBSD:
> https://github.com/openbsd/src/blob/2e342c845e9966c26657b08851237fc18e7b5ff5/sys/dev/usb/if_rum.c#L2024
> 
> FreeBSD:
> 1. 
> https://github.com/freebsd/freebsd/blob/499b2b565264824f2139ebcb5d1c97404a17e7e6/sys/dev/usb/wlan/if_rum.c#L2607
> 2. 
> https://github.com/freebsd/freebsd/blob/499b2b565264824f2139ebcb5d1c97404a17e7e6/sys/dev/usb/wlan/if_rum.c#L807
> 

I think you're probably looking for:

https://github.com/freebsd/freebsd/blob/499b2b565264824f2139ebcb5d1c97404a17e7e6/sys/dev/usb/wlan/if_rum.c#L1623

Note that I don't know anything about the if_rum driver in general, I
just know to look for occurrances of usbd_transfer_start().

-- Ian



___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Understanding how USB transmission works

2020-03-02 Thread Farhan Khan
Hi all,

I am trying to understand how FreeBSD's usb transfers work compared to OpenBSD 
by using the rum(4) driver. I am a little confused how the FreeBSD side works.

On the OpenBSD side, it seems that after allocating the pipes, you use 
usbd_setup_xfer and usbd_transfer(). As an example, look at OpenBSD's 
/usr/src/sys/dev/usb/if_rum.c, starting on line 2027-2029, I believe that 
corresponds to FreeBSD's /usr/src/sys/dev/usb/wlan/if_rum.c, line 2607 
(rum_setup_tx_list) which goes to 807. In this function, I see that it adds 
rum_tx_data (tx_data[i] to the end of tx_free. However, how does it actually 
send the data? I believe this occurs in the callback functions, specifically 
with the usbd_transfer_submit function, but I am not certain how that is 
triggered, especially when it is triggered by the driver, such as in a send 
function.

Please assist.
Thank you!

Links below to make it easy to follow:
OpenBSD:
https://github.com/openbsd/src/blob/2e342c845e9966c26657b08851237fc18e7b5ff5/sys/dev/usb/if_rum.c#L2024

FreeBSD:
1. 
https://github.com/freebsd/freebsd/blob/499b2b565264824f2139ebcb5d1c97404a17e7e6/sys/dev/usb/wlan/if_rum.c#L2607
2. 
https://github.com/freebsd/freebsd/blob/499b2b565264824f2139ebcb5d1c97404a17e7e6/sys/dev/usb/wlan/if_rum.c#L807

--
Farhan Khan
PGP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE

___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


[Bug 244553] i386 12.1-RELEASE fails to install from USB CD-ROM/DVD

2020-03-02 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=244553

Bug ID: 244553
   Summary: i386 12.1-RELEASE fails to install from USB CD-ROM/DVD
   Product: Base System
   Version: 12.1-RELEASE
  Hardware: i386
OS: Any
Status: New
  Severity: Affects Only Me
  Priority: ---
 Component: usb
  Assignee: u...@freebsd.org
  Reporter: vi...@vincentbentley.co.uk

The i386 installer images for 12.1-RELEASE in disc1, dvd1 and memstick forms
fail to install on a Dell FX130 using a USB DVD Writer drive. The hardware has
been running FreeBSD 10.x, 11.x and 12.0 to 12.0p13 in the past without a
problem. FreeBSD was installed from an .ISO image at each major version change
using the same hardware.

All of the following installer images fail to install. The optical media
versions boot, but cannot continue past FreeBSD's BIOS drive check. The
memstick version just beeps in a continuous loop when the machine is booted. 

SHA256 (FreeBSD-12.1-RELEASE-i386-disc1.iso) =
07b10e098e7c9b5e920679d3a9b3d12628f0b918c6e3962620b7f570a82cf41d
SHA256 (FreeBSD-12.1-RELEASE-i386-disc1.iso.xz) =
facebc504f63d0eb4615d83ecb6d4b7aabfa206276a1784f97afd756ea5121cb
SHA256 (FreeBSD-12.1-RELEASE-i386-dvd1.iso) =
72290eb4d203bedad90d0b63c0f507889858860a20f47a89141e6f4eb2cf0fad
SHA256 (FreeBSD-12.1-RELEASE-i386-dvd1.iso.xz) =
9da9beea7ebfdea1324a5305820f1a1eeb1eb7c640f8b4675931105b0fba4ad7
SHA256 (FreeBSD-12.1-RELEASE-i386-memstick.img) =
371451e0ee442629415c161e3b8e701eb2a2d11ad1da0d0f00e02e06f9b46abd
SHA256 (FreeBSD-12.1-RELEASE-i386-memstick.img.xz) =
485710488a94ee74a99a2b712d5ce41fb8178f3c4184b737eca74a963ef93be0

To eliminate potential hardware faults, a freshly downloaded ISO of
12.0-RELEASE dvd1 was downloaded, burned to media and installed successfully on
the FX130 using the USB DVD Writer drive. As was openbsd66.iso just to be sure.
The Dell FX130 is equipped with a VIA 686 class cpu. Both FreeBSD 12.0 and
OpenBSD 6.6 install and run perfectly well on this hardware.

The first 12.1 DVD that I burned was then used to boot an old Toshiba A100
laptop using it's internal ATA DVD drive. This booted and ran the installer
successfully. This same laptop was then used with the USB DVD Writer with
similar success with the 12.1 media. However, I did notice that this laptop
reports running Intel Boot Agent, whereas the Dell FX130 does not. Perhaps this
fault only affects Dell FX130 or maybe it is a VIA cpu issue?

I am currently running an in-place upgrade from 12.0 to 12.1 on the FX130 which
is taking some time to complete. This machine has never run 12.1 so if it
reboots successfully the fault could just be in the installer and not in the
kernel.

Logging this is a bug because this hardware has been used successfully for some
years with FreeBSD up until 12.1

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"