Access denied when using usb-port on T50 panel with DevLink

Hello,

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?

Hardware: 6PPT50.101E-10B

Thank you.

BR
Hanna Hermansson

Hi Hanna,

welcome to our Community!

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?
  • Do you have the latest T50 firmware installed?

Best regards!

Hi Alexander,

  • Yes it is connected to the IF3. Like you say, since the DevLink returns 0 the connection is established.
  • I get the same error 20706 when trying to create a file as well.
  • Image version 1.5.2

image

Best regards :sunny:

Hi Hanna,

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 :wink: ).

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).

Best regards!

@hermanssoh
Hi Hanna,

sorry for being curious :slight_smile:
Have you found the cause why itā€™s not working? Would be interesting to me, thanks in advance!

Best regards!
Alex

If there is requirement to test it, let me know. I have this hw in the office :wink:

1 Like

Hello,

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.

Best regards!

1 Like

@hermanssoh Then please mark your reply with conclusion or a reply that helps you most as a solution :slight_smile: It will help others. Thanks.

Hello again,

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?

Thank you.

Kind regards
Hanna

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:

  • .DeviceName := ADR(ā€œYOUR_FILEDEVICE_AS_BEFOREā€);
  • .FileName := ADR(ā€œYOUR_NEW_FOLDER/YourFileNameā€);

Best regards!

Hello Alexander,

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)

Do you have any further suggestions?

Best regards!

Hi Hanna,

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 :wink:

Maybe you could try to use a slash as path divider instead of a backslash?

Best regards!

Hello,

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)


Is it better to try another approach completely with the file IO library to open the recipes?

Best regards
Hanna :slight_smile:

Hi,

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.

Best regards!