I am using the usb-port on the T50 panel to read/write to a usb-stick(FAT32) using CIFS. I am using the FB Devlink to established connection to the usb and it succeeds to set it up as a network device. After that when I either use the DirInfo or DirCreate I get access denied. in the help for error 20706 this is stated:
In the case of CIFS file devices, check whether the file has already been opened for writing and if so, try to open it again for writing.
Here is how I call the functions
Device_param :=ā/SIP=10.100.20.5 /PROTOCOL=cifs /SHARE=usbshare /USER=ppts50-user /PASSWORD=Adminā;
USB_LINK_DEVICE:
(* Link device *)
DevLink_0.enable := 1;
DevLink_0.pDevice := ADR(Device_name);
DevLink_0.pParam := ADR(Device_param);
DevLink_0;
IF DevLink_0.status = 0 THEN (*FB works correctly, usb connected *)
StateMachine := USB_DIRECTORY_INFO;
ELSIF DevLink_0.status = ERR_FUB_BUSY OR DevLink_0.status = fiERR_NETIO_PARAMETERS THEN (*FB works asynchron => continue to call until not busy*)
StateMachine := USB_LINK_DEVICE;
ELSE
StateMachine := USB_ERROR;
END_IF;
USB_DIRECTORY_INFO:
DirInfo_0.enable := 1;
DirInfo_0.pDevice := ADR(Device_name);
DirInfo_0.pPath :=0; //ADR('Recipe') (*no path is needed => value = 0*)
DirInfo_0();
How can I get pass the access denied? How can I know if the file has already been opened?
As I understood, the DevLink_0 instance returns 0 on the .status, and the issue occurs after that, right?
So the T50 configuration should be already ok, the connection string should be valid, and the link should be established ā looks good for me so far, because I assume if thereās an error in the connection string or the T50 setup of enabling the network shares, the error should already happen after the DevLink call.
Sorry, stupid questions, but the first ones :
are you sure that your USB device is connected to IF3 of the panel? (Iām asking because IF4 has a different share name).
Could you try to create a file only, does that work? So that we can see if itās a topic about ādirectoriesā, or a more common one?
unfortunately I canāt test anything because I havenāt access to hardware at the moment.
But I would recommend to upgrade the PPT50 firmware to the latest one (1.6.2) to see if something changes.
I donāt know how the network sharing is implemented inside the PPT firmware, but if Samba is used inside the PPT50 for cifs network shares (I think it is), then at least in theory it would be possible that your DevLink returns 0 even if the user credentials are wrong (because after activation, maybe the cifs share is visible to āeveryoneā, but the read / write rights based on the file system rights of the user prohibit the access to the mass storage device ābehind the network shareā ā I donāt know if itās solved like that, but as I said: in theory it would be possible ).
So please double-check again the user credentials (especially the password that was set in the PPT configuration) and the string size of āDevice_paramā (if the whole parameter string content fits into the variable).
Also I would recommend for tests:
use a different USB stick (maybe the stick were not recognized by the firmware), and / or
try the access to the internal share with your user credentials, if it works there (so access to the share āusershareā - if it works there with the same credentials, then the issue is definitely linked with the used usb stick).
Iāve have it up an running now. Thank you for your help. I changed USB-stick and tried again and then it worked with my setup.
During my tests, I noticed that it will create a device and youāll get devlink return 0 if you connect a mouse with usb as well. But nothing else works with it. So that can be good to keep in mind depending on your application.
I have some further issues related to this. After I have established connection I create a folder on the USB with dirCreate. But then I canāt access the folder. I want to save recipes to that specific folder but I get the errors of either 20709 or 32769.
For the device name I have tried to add the recipe folder or by using devLink again but to the recipefolder and none of them are working. Do you know how I can solve this?
Hi Hanna,
have you already tried to add your folder name to the filename instead of adding the folder to file device? If not, I would suggest trying the following syntax, for example if using mpRecipeXml or mpRecipeCsv:
Iāve tried that now and it doesnāt work. I get the error
Description: Failed to create recipe file USB\test.csv using device USB (Error cause: 20723)
sorry, if that doesnāt work Iāve no more idea. At least I know that working with a path in the filename worked in past (but it was a Windows share), but itās some time ago when I tried and right now Iām in holiday so I canāt test it
Maybe you could try to use a slash as path divider instead of a backslash?
It works now with the backslash in the filename! Recipe\FileName
But after that i try to use the MP Recipe UI Connect to list all the files inside the folder. But I canāt access the folder and instead it just lists everything on the USB(the set deviceName)
yes, the file device points to the USB stick root, and as I know thereās no way to preconfigure a sub folder as entry point for mpFile/mpRecipeUI.
If you donāt need that much user interaction in your application thatās provided via mpRecipeUI or mpFileUI, I would also propose to implement a own FileIO based solution, like you already mentioned.
Itās some more work to do, but then you have the complete freedom on how it should work.