Hello all, This is one of my blue moon times when I poke my nose briefly into USB stuff and raise a ruckus before lurking off onto other things... I've got at least two past topics I need to revisit, but that will be for another day...
This time I've been poking at the PNY/datafab storage code trying to get my dual slot reader to work. I've noticed some interesting things, some of which explain another problem someone else noticed at one time... The reader that I have is not immediately recognized. It has vendor code 0x07c4 and product code 0xa109. As a first order experiment, I "cloned" the 0x07c4:0xa005 PNY/Datafab entry in unusual_devs.h. This seem to be productive and do the right thing with some "side effects" which may or may not be peculiar to this particular product ID. There seem to be problems in that code which simply should NOT work. The CF reader seems to work but the SmartMedia slot does not. That is even mentioned in some of the archives and some other things I've read on the net. I think I know part of why not, now. The other thing I noticed (and that someone reported months ago as a rare random anomoly) is that I got TWO SCSI drives that mapped to the same slot (the CF Slot). Amusing and somewhat disturbing... Trying to debug some of this I noticed some interesting remarks in reading datafab.c about the slots and the LUN. Ok... The max lun for this transport gets set to 1, which should be good for a two slot reader. For shits and giggles, I bumped it to two and I then had THREE drives mapped to the same slot! Hmmm... Clue alert... I added some additional debugging to the datafab.c code and discovered that while datafab_transport is being called with srb->lun set to 0 or 1 as appropriate, the code in datafab_read_data uses a DIFFERENT lun (the one out of the "extra" private info blob) and that LUN never gets mapped to the LUN of the calling srb. Well... That explains the multiple devices mapped to the same slot. The USB storage code is calling that transport with srb->lun set to zero, then one, but the read code only ever sends requests to info->lun == 0. So, of course, both lun's look the same from the higher levels and the second physical slot can never actually be accessed. Which then also explains why the second slot, the Smart Media slot, doesn't stand a snowball's chance in hell. Simply setting info->lun = srb->lun in datafab_transport seems to do extremely vicious ugly things (like cause fdisk to hang as soon as I touch the device and it can't be killed - have to reboot the box) so I guess that's not the answer either. The fdisk hanging trick is similar to what happens when I have the reader plugged in with no cards and try and run fdisk. Definitely a no-no. That's something ELSE that needs some debugging. The debug prints don't seem to indicate that the datafab_determine_lun routine (which sets info->lun) ever gets called and, even if it does, it doesn't make sense that it could ever do the right thing. I'm not sure just how it should work but querying the LUNs looking for which one is responding while ignoring which one we are trying to talk to just does not seem like the right thing to do. Finally, if I remove the CF card and the reinstall the same card, fdisk comes back with bogus numbers to the first time (and the debug prints indicate errors in the USB subsystems) and I have to quit it and reenter it. Second time in, the numbers are correct. Same thing if I try using mount. Remove a card and reinstall it and the mount fails the first time and works the second time. The debugging messages indicate that a command ALLOW_MEDIUM_REMOVAL is being issued but I see absolutely no indication of a medial removal or insertion event taking place. I don't know how that is suppose to work, but it's obvious that the usb-storage and SCSI subsystems have no clue that the media was changed and are not handling the resulting error cleanly. I haven't tried hard-coding the info-lun to be 1 yet. That would tell me if the code was at least able to talk to the Smart Media slot, but I would like them to BOTH work and work simultaniously. There seem to be several problems in there that need solving before that can work. So it seems that 0x07c4:0xa109 can be added to the list of datafab devices and one of the slots works. Anyone seeing multiple usb-storage drives mapped to the same device should look into the issue of LUN's and that device and driver. Anyone with patch suggestions for getting the second slot working on my reader, let me know. I know the authors of that module have stated that they don't have SmartMedia for testing. I do, I have both, and I love to test and debug... Mike -- Michael H. Warfield | (770) 985-6132 | [EMAIL PROTECTED] /\/\|=mhw=|\/\/ | (678) 463-0932 | http://www.wittsend.com/mhw/ NIC whois: MHW9 | An optimist believes we live in the best of all PGP Key: 0xDF1DD471 | possible worlds. A pessimist is sure of it! _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel