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!