Good day,
This is the italian forum. For italian support, please let us know. For english, please use the following link:
https://learn.microsoft.com/en-us/answers/questions/
Questo browser non è più supportato.
Esegui l'aggiornamento a Microsoft Edge per sfruttare i vantaggi di funzionalità più recenti, aggiornamenti della sicurezza e supporto tecnico.
Hi, I am trying to create a cross-platform app with .net maui. The purpose of the app is to be able to communicate with a USB device (HID) by sending and receiving raw data. After much research I managed to find the library ‘hidlibrary’ which works perfectly on Windows form, however on .net maui at the first instruction to receive data it gives me the exception ‘Operation not supported on this platform’. How can I solve this? Am I taking the wrong approach? Thanks in advance
Good day,
This is the italian forum. For italian support, please let us know. For english, please use the following link:
https://learn.microsoft.com/en-us/answers/questions/
Buongiorno, Simone,
il seguente potrebbe aiutare:
Activity act = Platform.CurrentActivity;
UsbManager manager = (UsbManager)act.GetSystemService(Context.UsbService);
IDictionary<string, UsbDevice> devicesDictionary = manager.DeviceList;
UsbDevice dvc = devicesDictionary.ElementAt(0).Value;
string ACTION_USB_PERMISSION = "rzepak";
var interf = dvc.GetInterface(1);
outEndpoint = interf.GetEndpoint(1);
PendingIntent mPermissionIntent = PendingIntent.GetBroadcast(act, 0, new Intent(ACTION_USB_PERMISSION), 0);
IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION);
if (manager.HasPermission(dvc) == false)
manager.RequestPermission(dvc, mPermissionIntent);
deviceConnection = manager.OpenDevice(dvc);
if (deviceConnection != null)
deviceConnection.ClaimInterface(interf, true).ToString();
else return false;
deviceConnection
e' un tipo Android.Hardware.Usb.UsbDeviceConnection
aperto in modalita' di conessione:
byte[] test = new byte[] { input };
if (deviceConnection.BulkTransfer(outEndpoint, test, test.Length, 500) < 0)
Connected = false;
c'e' sempre la pagina iniziale, con tutta l'informazione disponibile da Microsoft: