OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Hardware => Topic started by: Igor on January 21, 2023, 02:43:35 pm

Title: USB32 USBMSD problem of re-read diskette
Post by: Igor on January 21, 2023, 02:43:35 pm
The problem is partially solved by replacing the USBMSD driver with a similar one of the 16-bit version. At the same time, USB2 disk2 work and do not operate USB3 discs.
Provided to replace the diskette in the drive is determined and re-read correctly and all functions also work correctly - recording, reading, formatting, which unambiguously indicates a problem in the USBMSD driver from AN.
To my regret, AN, after my appeal, did not show interest in solving the problem, despite the ticket issued according to their requirements. They referred to the fact that everything works for them.
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Lars on January 21, 2023, 05:11:05 pm
As can be seen in this video:

https://www.youtube.com/watch?v=9vXKvku6y5A

the presenter stated that none of his 3 USB floppy drives would work with ArcaOS (I assume 5.0.x), so that answers the "everything works for us".

I assume that with the "USBMSD driver of the 16-bit version" you mean the USBMSD.ADD from my USB driver set.
Yes, I can tell you that it needed quite a few fixes to redetermine the inserted floppy media. And I know that it works with my updated driver because I have a USB floppy drive to test with.

I am pretty sure that AN never picked up these fixes and they never will.
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Lewis Rosenthal on January 21, 2023, 09:06:48 pm
Hi, guys...

Test system here:

ThinkPad T560
Lenovo Docking Station (17EF:1010 (HS hub with single TT) Lenovo ThinkPad Ultra Dock Hub)
ArcaOS 5.0.7
USB stack 12.14 / USBMSD.ADD /FLOPPIES:1
Teac FD-05PUW (0644:0000 (MSD)-(UFI)-(CBI-I) FS TEAC Corp. Floppy)

Device hot plugs. Insert media; able to read, able to write; eject media; insert different media; able to read, able to write.

Same system, but swap out the Teac drive with:

IBM USB portable FDD (057B:0000 (MSD)-(UFI)-(CBI-I) FS Y-E Data, Inc. FlashBuster-)

Same result. Disks insert, readable, writable, eject, replace with different disks, reading/writing still possible.

The only thing I didn't test was formatting. Okay, testing... Formatting works as expected (in the IBM drive, at least).

I fail to see what is wrong, sorry.
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Lars on January 22, 2023, 01:59:46 pm
I think I can tell you what`s wrong: a few years ago, you (Lewis), sent me a Mitsumi USB floppy drive to test.
And that drive did NOT work with the USBMSD.ADD back at the time. Seemingly, there are drives that are more sophisticated, there are even drives that can actually eject a diskette via a command (instead of a mechanical eject), there are drives that have a "diskette change" signal and therefore do not need to be polled for a change but this "cheapo" drive would not do.
After quite some fiddling I found out how to properly interpret the "sense codes" that the USB floppy drive sends back. I then based the media (re)determination on the "proper" sense codes to react upon. Additionally, had to add some logic when and how to reattempt reading from media.
So, as so often with USB, not every USB floppy drive is equal.
That also solved the problem that it is no longer required to have a diskette already inserted when attaching the USB floppy drive to have the diskette propery be detected if you want to access it later on. Plus the desperate attempts of the OS to read from a USB floppy diskette ad infinitum whenever the "Drives" object is opened (and no diskette is inserted in the floppy drive).
Again look at the video: that guy is saying that he tried with 3 different USB floppy drives and none would work.

https://youtu.be/9vXKvku6y5A?t=601
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Igor on January 22, 2023, 03:07:32 pm
Hi, Lewis!

Hi, guys...
...
I fail to see what is wrong, sorry.

I completely believe that you do not see what is wrong. I understand perfectly well that everything works for you and does not question your messages.

However, I have a device that works with Windows 7, works with another driver and does not work with your driver.

I propose to make tests for your instructions for you, send additional logs.

P.S. A long time ago (more than 20 years ago) in a distant galaxy... I worked as a programmer in large projects of American companies. If I answered the customer to the claim that I have the software I developed work properly, I would have lost my job :(
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Igor on January 22, 2023, 03:11:17 pm
I assume that with the "USBMSD driver of the 16-bit version" you mean the USBMSD.ADD from my USB driver set.
I spoke incorrectly about the 16-bit version. I really meant your version of the driver. The bit has nothing to do with this.
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Michael on January 22, 2023, 03:54:42 pm
Unfortunately, mine doesn't work under Arcaos either. I also use a ThinkPad T560 with a docking station, although the USB ports in this combination on the dock do not work anyway.
Unfortunately I cannot use Lars drivers because there is no USB 2.0.
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Lewis Rosenthal on January 22, 2023, 04:11:48 pm
Igor: You and I seem to have the same floppy drive (Teac USB ID 0644:0000). David also has one of these. Considering that David's and my drive work and yours does not, I would have to say that this is likely not something related to the USB stack (yes, I get that Lars' USBMSD driver works), but rather something unique to these systems where the drives are not working (and/or where the AN stack performs additional error checking which perhaps Lars' driver does not - and that is just a WAG on my part).

Michael: Have you opened a ticket with Arca Noae and provided a testlog for one of your drives which does not work? Are you also saying that the ports in your dock do not work? This could point to a number of other issues beyond software.
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Lars on January 22, 2023, 05:34:15 pm
So you are saying, the AN USBMSD driver does better error checking than my driver and that's why it will not work practically whereas my driver does no error checking and that's why it works ?

That does not seem to make a lot of sense to me ...

By the way: I added a LOT of error checking to the driver. It is not on the same level as it was delivered by IBM as part of their DDK.

To me it rather looks like David is seeing problems where there aren't any.
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Lewis Rosenthal on January 22, 2023, 06:38:34 pm
Lars, I mean no disrespect, and do not mean to imply that one driver performs more or better checking than the other, but perhaps *different* checking.

I'll have to look at Igor's testlog output again, but all I can say right now is that we have what should be the same hardware, and yet, mine works and his does not. I'm confident that your stack would work for my drive, as well. So, I'm only positing that there may be other factors at play instead of an actual software defect.

Thanks for all you do, my friend. ;)
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Dave Yeo on January 22, 2023, 07:16:06 pm
Wonder whether the hardware could be different even with the same USB ID? I could imagine a hardware change happening without an ID change.
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Michael on January 22, 2023, 07:26:59 pm
Hello Lewis,

with regard to the disk drive, I will still wait for a result for Igor. I looked at the ticket and he describes the exact same problem as I have.

Because of the USB connections at the docking station, I will open a ticket as soon as I have time.

All in all, I would also like to express my thanks for the great work that is still done for OS/2 - whether non -profit and commercial.
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Lars on January 23, 2023, 01:45:55 pm
Hallo Igor, Michael,

this is an excerpt of the readme for USBMSD.ADD in its original IBM version 10.162 which was the base for further development for both drivers, that from AN as well as my driver set:

Code: [Select]
2.7 Known Limitations
=====================
 
2.7.1  Only USB Memory Keys sized 16MB or larger are supported.
 
2.7.2  IBM 32MB USB Memory Key and Iomega PocketZip USB drive cannot be
       suspended/resumed properly. These devices must be ejected and
       then detached before you start the suspend mode.
       
2.7.3  Eject must be executed for the USB removable drive prior detaching
       (switching off) it from working system. This is necessary for correct
       drive operation after re-attaching the drive.
 
2.7.4  Some USB floppy disk drives (i.e. IBM USB Portable Diskette Drive,
       ASM P/N 06P5222, FRU P/N 06P5223) are known to become inaccessible
       if there was no diskette in the drive during boot/attach time.
       To avoid this, a diskette should remain in the drive while the system
       is booting or while the drive is being attached.
 
2.7.5  Removable device monitoring utility works only under OS/2 Warp 4 
       with Convenience Pack 2 installed and OS/2 Warp Server for e-business 
       with Convenience Pack 2 installed. USB Basic support must be upgaded
       to the latest version before installing the removable device monitoring 
       utility.

Are you experiencing the effects described in 2.7.4 ?
If yes, I would suspect that AN has rebased their development of USBMSD.ADD on the original DDK source code (apart from adding support for superspeed media which was mentioned somewhere).
Properly handling USB floppy drives need changes to the DDK source code to work properly.

If not, there is another potential for problems if the USB floppy disk drive is the same but the USB host controller HW/FW is different.
As far as I remember from the XHCI spec, a few of the things that Host Controller Driver SW had to implement in SW for UHCI/OHCI/EHCI is now executed totally autonomously by the Host Controller HW/FW. So, if the host controller HW/FW differs, then things might fail even though the USB floppy drive is the very same.

When I attach my USB (1.x) floppy drive under Windows 11, it is never able to detect (left alone use) it. It always plays the "attach sound" and then Windows 11 reports that it could not read descriptor info (which is about the very first thing that needs to be done, before anything else). Since for XHCI, some things are done completely in HW/FW, no SW on planet earth can work around that problem. My Windows 11 notebook has USB 3 only (but I suppose it has some rate matching hub to be able to use USB 1.x and USB 2 devices).

My OS/2 bare metal machine is older, has an AMD CPU and chipset, still has USB 2 (and USB 3) support and will happily accept the USB floppy drive. But I am using USB 2 and not USB 3.



Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Lewis Rosenthal on January 23, 2023, 03:08:46 pm
Hi, Lars...

I happen to have an IBM FRU 02P5223 right here, and it works perfectly well attached to the same T560 USB3 port in the dock as my Teac, with or without media inserted at time of connection. This information from the DDK is considerably outdated, and of little to no relevance to the 32-bit AN driver..

David completed extensive reworking of USBMSD.ADD in the 12.04 release of the AN stack (March, 2020) when he converted it (USBMSD.ADD) to 32-bit. There was a lot of broken stuff in the IBM code (including at least one null pointer). Frankly, it's rather amazing that the IBM code worked as well as it did.
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Igor on January 23, 2023, 03:24:41 pm

Code: [Select]
2.7.4  Some USB floppy disk drives (i.e. IBM USB Portable Diskette Drive,
       ASM P/N 06P5222, FRU P/N 06P5223) are known to become inaccessible
       if there was no diskette in the drive during boot/attach time.
       To avoid this, a diskette should remain in the drive while the system
       is booting or while the drive is being attached.
 

Are you experiencing the effects described in 2.7.4 ?
 

Not certainly in that way. Even if the diskette was inserted at the time of loading the system does not work correctly when changing the diskette.
If the diskette is replaced by the driver AN does not notice this and when trying to record it saves on the new FAT disk with the one that was in the drive at the time of boot.
Additionally, I want to indicate that I use exclusively USB2.0 to connect a USB drive.
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Lars on January 23, 2023, 05:39:48 pm
Right now I can only say this:
what you are experiencing is a bug in the media redetermination when one diskette is swapped with another.
When I was working on it, I was seeing that exact problem until I finally got that fixed.

If Lewis claims it works for him with the very same USB floppy drive as yours then either your host controller FW/HW is not the same as that of Lewis or it is a timing issue in USBMSD.ADD (USBMSD.ADD uses a timer interrupt routine to handle command timeouts plus context hooks to offload asynchronous processing to a suitable future point in time. Both, timer interrupt routines and even more so context hooks are influenced by and influence timing. What's more, invocation of context hooks can be delayed by invocation of other context hooks, scheduled by other drivers).
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Igor on January 23, 2023, 10:35:56 pm
I can say about the timer that I know that the AN software contains an error (still?) Because of which we have a crutch SET NSPR_OS2_NO_Hires_Timer=1 in the config.sys file.
Nevertheless, I tried to run this set of drivers in the system where this error is eliminated. This did not bring a positive result and the timer error and the drivers mistake are different.
However, of course, the proper processing of equipment timouts is a very important thing. And I want to note that your software, as well as Windows, successfully copes with this.
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Lars on January 24, 2023, 08:40:38 am
I do not have the same USB Floppy Drive as you have but I now did some further tests with the USB floppy drive that I have.
1) I tried it on my notebook with Win 11, Intel CPU, USB 3.x: it will never attach, no matter how often I try.
2) I tried it on my Tower PC with Win 10, AMD CPU, USB 2.x and USB 3.x: it has problems attaching. Initially I attached to a USB 2.x port which did not work. I then tried a USB 3.x port and that helped. I had to plug multiple times but it would finally come alive. Initially, it would report error that "device descriptor cannot be read"
3) I tried it on the very same Tower PC with OS/2 (and USB 2.x only): it also does not always attach but the situation is better than with Win 10. Eventually, after unplugging and replugging, it will come alive.

What I can remember from the USB floppy drive that I have is that on device attach it needs multiple "DRIVE READY" commands to trigger the drive electronics and convince the motor to spin up. That command would need to be repeated until it would no longer return with an error (naturally, you would limit the attempts to some maximum retries).

So, taking the current situation, I would believe that USB floppy drives in general are not very reliable and sometimes need quite a few attempts until they finally come alive. This is likely true on each new media insertion. And it will vary from system to system.

Since I am not a AN customer, maybe you can add that to your problem report.

Another solution would be to buy a new up-to-date USB floppy drive.
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Igor on January 24, 2023, 04:48:08 pm
Of the known problems of USB devices, I only faced with the problem of electrical contact in the connection. David pointed to me a large number of USB errors and I really found bad contact in the connection. Windows reacted to him with an unstable definition of a floppy disc drive. I eliminated poor contact and now the equipment is determined stably.

When loading the driver, he gives a command to rotate the drive engine only if the diskette is inserted. Your driver performs this operation regardless of the presence of a diskette. This is a significant difference at the time of loading.
Subsequently, the AN driver does not track the fact that the diskette is removed and does not conduct the "Drive Ready" check when addressing the diskette.
If timeouts affect the work of equipment, it would be the best decision to give the user the number of repetitions, for example, through the command line key.
Title: Re: USB32 USBMSD problem of re-read diskette
Post by: Lars on January 24, 2023, 05:30:09 pm
By now, I don't think it is a timing problem in the driver. It is a problem of not testing for an inserted media long enough for the drive to react. The number of retries is too low and/or the check for inserted media is not done at all places required plus the returned error info ("sense code") is not properly taken into account (the "sense code" will for example tell you if the drive is not ready, does not contain media or if the media has just been swapped and whole bunch of other potential error/status conditions). Then, for a USB floppy drive, you need some special handling regarding the fact media might not be inserted (for a USB memory stick, the "media" is always "inserted"). That is what you observed: to try and access the media when there is no media inserted will lead to that typical "rattling sound" and Windows does the same.

What I did in the past was to install "Wireshark" under Windows which contains an additional "USB capture" feature (USBpcap).
That is what I used to track what commands in what sequence Windows issues against the USB floppy drive (by using it under Windows). I then modified USBMSD.ADD to follow that sequence (as good as that was feasible), including some guesswork about necessary retries.

And regarding that it works on one system while it does not on another system: the USB floppy drive HW has some physical variation even if it is the very same model (but a different physical drive !) and that can lead to one drive needing more retries than another drive (for example). This has to be anticipated and taken into account. You just cannot test against each and every USB floppy drive on planet earth.