Hi

In Go, define an interface for opening the device and writing to it.

Implement that interface in Java/Kotlin using the Android API for 
interfacing with USB.

I used this without any issues in the BitBoxApp, which is an Android App 
that communicates with the BitBox02 hardware wallet:

Go interface:

https://github.com/digitalbitbox/bitbox-wallet-app/blob/1e1e2c6a4cfb0760eae472e759b0974d114fbdea/backend/devices/usb/manager.go#L47-L57

Java implementation:

https://github.com/digitalbitbox/bitbox-wallet-app/blob/1e1e2c6a4cfb0760eae472e759b0974d114fbdea/frontends/android/BitBoxApp/app/src/main/java/ch/shiftcrypto/bitboxapp/GoViewModel.java#L30

Cheers
On Friday, July 9, 2021 at 11:17:15 PM UTC+2 Óscar Giménez wrote:

> Hi,
>
> Were you able to solve this issue?
> I'm facing the same problem.
> Any help would be appreciated.
>
> Thanks
>
> On Sunday, August 21, 2016 at 1:32:48 AM UTC+2 con...@theninjabunny.com 
> wrote:
>
>>
>> I'm developing an Android app using Golang that make use of a USB device 
>> connected to the Android (on those that support the host mode). My app 
>> works great if the device is rooted and SELinux is in permissive, 
>> unfortunately that's not common at all.
>>
>> To avoid that, you could open the USB device in Java (usbManager) and 
>> then pass the file descriptor to the NDK (Go) code. At this point, I'm not 
>> sure if it's possible at all, or the x/mobile code has to be modified, but 
>> I have no idea how to continue nor where to find more information on the 
>> topic.
>>
>> Using gomobile/bind for the app
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/612de7dc-6254-4228-b171-4baeb7991c2bn%40googlegroups.com.

Reply via email to