On Thu, 10 Aug 2006, Klaus Muth wrote:

> Dear mailing list, dear Alan,
> 
> please forgive me for sending tons of debugging log. Today I learned about 
> dmesg -c, which helps a lot...
> 
> Am Donnerstag, 10. August 2006 08:11 schrieb Klaus Muth:
> > > Anyway, here's something you can try that might help.  Before plugging in
> > > the device, do this:
> > >
> > >   modprobe scsi-mod
> > >   echo 'SRE:OPTAC Tool:0x80000' >/proc/scsi/device_info
> > >
> > > If it still doesn't work, please provide another verbose usb-storage
> > > debugging log.
> >
> > NoGo. I'll provide full log with CONFIG_USB_DEBUG=y later
> Ok. dmesg output after 
> # modprobe scsi-mod
> # echo 'SRE:OPTAC Tool:0x80000' >/proc/scsi/device_info
> and plugin of the device:

...

> Hmmm. As far I can see, this ALLOW_MEDIUM_REMOVAL is issued despite of the 
> blacklist entry. So:
> # cat /proc/scsi/device_info | grep OPTAC
> 'SRE     ' 'OPTAC Tool      ' 0x80000
> Maybe OPTAC Tool does not match because of the spaces?

The spaces shouldn't cause a problem; they are supposed to be there.

This should have worked.  I don't understand why the command was issued.
If you feel up to a little kernel debugging, you can try to figure out 
the reason.  Here are the things you need to know.  Most of the files 
mentioned below are in the drivers/scsi/ directory of the kernel source.

When you do the "echo" command, it is handled by scsi_devinfo.c:
proc_scsi_devinfo_read().  This much worked correctly, as verified by your 
"cat" command.

When the device is detected, the system calls scsi_devinfo.c:
scsi_get_device_flags().  This routine should have found the entry you 
created.  The interesting part of the code is at the end, the case where 
devinfo->compatible is false.  If you put a printk statement there, you 
should be able to see what happens when the device's information is 
compared with your entry.

That routine is called from scsi_scan.c:scsi_probe_lun(), the line that 
says

                *bflags = scsi_get_device_flags(sdev, &inq_result[8],
                                &inq_result[16]);

This should set *bflags to the 0x80000 value that you wrote.  Again, you
can test that.  The value is used later in scsi_add_lun(), where the code
says:

        if (*bflags & BLIST_NOT_LOCKABLE)
                sdev->lockable = 0;

(Note that include/scsi/scsi_devinfo.h defines BLIST_NOT_LOCKABLE as 
0x80000.)  So sdev->lockable should be set to 0.

Finally, sdev->lockable is used in scsi_ioctl.c:scsi_set_medium_removal().  
It's tested right at the start of the routine, and when the value is 0 the 
routine will return immediately without sending the PREVENT-ALLOW command.  
Again, you can test that.

Alan Stern


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to