Skip navigation.
Home
The QNX Community Portal

View topic - USB issue in 4.25 2011

USB issue in 4.25 2011

For the old QNX2 and QNX4 RTOS

USB issue in 4.25 2011

Postby ingraham » Tue Sep 27, 2011 9:10 pm

I'm having a rather bizarre problem with USB using the QNX 4.25 2011 release.

1) Boot the machine from hard drive (PATA).
2) Plug in a flash drive on a USB port.
3) Copy the hard drive to the flash drive.
At this point, everything is fine. chkfsys and dcheck both say the flash drive is okay.
4) Reboot, this time with a floppy.
5) Copy the flash drive contents back to a hard drive.
PROBLEM! At this point, some file are corrupted on the hard drive. Even stranger, some files are corrupted on the flash drive!

Notes:
a) I'm being careful not to overwrite .inodes or .bitmap in either direction.
b) We've tried numerous hard drives and several different flash drives.
c) Yes, the boot floppy is not PRECISELY the same as the hard drive. However, I also tried it once booting from a hard drive, and copying from the USB stick to a secondary hard drive.
d) On a related note, copying from primary to secondary works fine.
e) I have so far only tested this on one machine, so it could be purely hardware related. I'm working on getting another test machine up and going.

So, has anybody else run in to this issue?

Thanks,
James Ingraham
Sage Automation, Inc.
ingraham
Senior Member
 
Posts: 160
Joined: Wed Nov 05, 2003 2:25 pm
Location: Texas

Re: USB issue in 4.25 2011

Postby ingraham » Wed Sep 28, 2011 8:28 pm

Small update: I have now tried this on a different machine and gotten the same result. How in the **** is the device I'm copying FROM getting corrupted?!?

-James
ingraham
Senior Member
 
Posts: 160
Joined: Wed Nov 05, 2003 2:25 pm
Location: Texas

Re: USB issue in 4.25 2011

Postby maschoen » Sat Oct 01, 2011 6:39 pm

I have two things to watch out for.

1) You did initialize the stick with dinit? If drive was formatted as Fat 32 you would have problems.

2) After the copy operation is complete, you should be careful not to remove the stick until the cache is flushed. I've found that "sync" does not do what I expected it to do, wait until the cache is flushed.
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm

Re: USB issue in 4.25 2011

Postby ingraham » Mon Oct 03, 2011 2:46 pm

1) Yes, I have properly formatted for QNX, in two different ways. A collegue of mine likes to dinit -hq /dev/hd1 and use it directly. This bugs me on several levels, so I fdisk /dev/hd1, remove all partitions, create a partition of type 77 that is (at most) 1024 cylinders, do a mount -p /dev/hd1, then dinit -hq /dev/hd1t77. Admittedly, his way is a lot less effort, but I just feel like it's not the "right" way to do it. In any case, I have done both.

2) Two thoughts here. First, we've left the machine overnight to try to make sure all operations were complete. We've also done sync and umount. Nothing helps. Second, why would any of that matter reading FROM the flash? No matter what operations haven't finished, it shouldn't be writing ANYTHING to the flash, so even if I interrupt an operation the flash should still be fine.

Still baffled, but thanks for putting some thought into it.

-James Ingraham
ingraham
Senior Member
 
Posts: 160
Joined: Wed Nov 05, 2003 2:25 pm
Location: Texas

Re: USB issue in 4.25 2011

Postby mario » Mon Oct 03, 2011 5:54 pm

Unless you've mount the flash to be read-only, just reading to it will modify its content, because the last access time will need to be updated. Fsys has an option to disable this feature (making it non-posix compliant), but it affects all partitions/devices.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Re: USB issue in 4.25 2011

Postby maschoen » Mon Oct 03, 2011 7:43 pm

Yanking a USB stick out while being updated is not the same as pulling the power on a hard disk.

When you write to a USB sector X is not always in the same place. Otherwise frequently written sectors could wear out quickly.

I would hope that the firmware in a USB would be designed to minimize damage, but I don't know the specifics.

That doesn't really answer your question though.

On the dinit issue, unless you want two partitions or if you want to boot, having a partition is unnecessary. Just think of the stick as a very large floppy diskette.
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm

Re: USB issue in 4.25 2011

Postby ingraham » Thu Oct 13, 2011 9:45 pm

I still don't actually know what's going on, but I have found a work-around. Thanks to mario's suggestion, I discovered that mount has a -r option for read-only. This appears to work.

I am nevertheless still annoyed at baffled by the problem.

-James Ingraham
Sage Automation, Inc.
ingraham
Senior Member
 
Posts: 160
Joined: Wed Nov 05, 2003 2:25 pm
Location: Texas


Return to QNX2 and QNX4

Who is online

Users browsing this forum: Exabot [Bot] and 1 guest

cron