[sane-devel] Authorization , plug on plug off the usb scanner ??
Tamkang
power_station_2001 at yahoo.com
Tue Mar 28 05:46:58 UTC 2006
I have a Question that I encounter when I debug microtek2.c there is an Authorization function , when it will use ? is it when open xsane as a user not as a root so I must login first not as root and after that I can use the scanner , there is a problem that I don't understand where is goes wrong in this situation:
1. when I use user login not root and then open xsane will have error the scanner I / O Port failed and the when I debug step by step to look for the error , it seems step into the sane_open function, and when after usb_open is open the handle device and after that step to usb_claim_interface it return error code.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
sane_open (SANE_String_Const devicename, SANE_Handle *handle)
{/*This function may return with one of the following status codes.
1.SANE_STATUS_IO_ERROR: An error occured while communicating with the device.
2.SANE_STATUS_NO_MEM: An insufficent amount of memory is available.
3.SANE_STATUS_GOOD: XSane Open successfully.
*/
Microtek_Scanner *ms = NULL;
Microtek_Device *pdev;
if (devicename[0])
{/* selected */
for(pdev = pdevFirst;pdev; pdev = pdev->next)
if(!strcmp(devicename,pdev->sane.name))
break;
/* no dynamic post-registration */
}else
{
pdev=pdevFirst;
}
if (!pdev)
return SANE_STATUS_INVAL;
ms = (Microtek_Scanner *)calloc(1, sizeof(Microtek_Scanner));
if(!ms)
return SANE_STATUS_NO_MEM;
ms->dev = pdev;
ms->next = ms_first_handle; /* register open handle */
ms_first_handle = ms;
//ms->model = pdev->model; /* memorize model */
/* open and prepare USB scanner handle */
ms->hdev = usb_open(pdev->dev);
if (!ms->hdev)
return SANE_STATUS_IO_ERROR;/*SetError(this,SANE_STATUS_IO_ERROR, "cannot open scanner device"); */
if (usb_claim_interface(ms->hdev, 0))
return SANE_STATUS_IO_ERROR;/*SetError(this,SANE_STATUS_IO_ERROR, "cannot claim IF"); */
if (usb_set_configuration(ms->hdev, 1))
return SANE_STATUS_IO_ERROR;/*SetError(this,SANE_STATUS_IO_ERROR, "cannot set USB config 1"); */
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
after has appear this SANE_STATUS_IO_ERROR , I try to plug off the USB cable or plug off the power adapter from scanner and after 2 seconds, I plug on it again and after that I re-run the xsane and it succesfull open xsane, but when I restart the computer and use other to login not root it still have the problem SANE _STATUS_IO_ERROR, where is goes wrong ? it seems need root authorization isn't it ? because I use root there is no problem with IO ERROR.
I use REDHAT 9 kernel 2.4.20-8 and sane-backend 1.0.15 and xsane.0.97
Thanks for your help
Best regards,
sofian
---------------------------------
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20060327/892e75c8/attachment-0001.htm
More information about the sane-devel
mailing list