question

Nimila Hiranya avatar image
Nimila Hiranya asked Jeffrey Blattman commented

USB Device Permission issue on Clover Station C500

I'm trying to grant permission to a Brother Printer to be connected via USB on my app.

I have written the following sample app to test it.

https://github.com/nHiRanZ/usb-connector-sample-app

The device permission granting works on devices like Clover Mini 2, Station Duo. But in the Clover Station C500 with Android 7.1.2, the permission granting doesn't work.

while (true) {
    System.out.println(usbManager.hasPermission(usbDevice));
    if (!usbManager.hasPermission(usbDevice)) {
        usbManager.requestPermission(usbDevice, permissionIntent);
    } else {
        break;
    }
    try {
        Thread.sleep(1000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

I have added the above code to keep checking for permission and request it until it's granted. The popup keeps showing up and the BroadcastReceiver I've added to get the permission grant status doesn't get triggered on the C500.

What is the cause of this?

I'm seeing the following logs on logcat after granting permission before the next grant pop-up shows up.

2022-09-26 18:01:34.302 581-1018/? I/AudioPolicyManagerCustom: FLAG None hence request for a primary output
2022-09-26 18:01:34.302 581-1017/? I/AudioPolicyManagerCustom: FLAG None hence request for a primary output
2022-09-26 18:01:34.306 581-747/? D/audio_hw_primary: start_output_stream: enter: stream(0xf1a1f000)usecase(1: low-latency-playback) devices(0x2)
2022-09-26 18:01:34.306 581-747/? D/audio_hw_primary: select_devices: out_snd_device(2: speaker) in_snd_device(0: )
2022-09-26 18:01:34.306 581-747/? W/msm8974_platform: Codec backend bitwidth 16, samplerate 48000
2022-09-26 18:01:34.306 581-747/? D/hardware_info: hw_info_append_hw_type : device_name = speaker-liquid
2022-09-26 18:01:34.306 581-747/? D/audio_hw_primary: enable_snd_device: snd_device(2: speaker-liquid)
2022-09-26 18:01:34.317 581-747/? I/audio_hw_primary: select_devices Selected apptype: 69936
2022-09-26 18:01:34.318 581-747/? D/ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 14, path =  0
2022-09-26 18:01:34.318 581-747/? D/ACDB-LOADER: ACDB -> send_asm_topology
2022-09-26 18:01:34.318 581-747/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_STREAM_TOPOLOGY_ID
2022-09-26 18:01:34.318 581-747/? D/ACDB-LOADER: ACDB -> send_adm_topology
2022-09-26 18:01:34.318 581-747/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TOPOLOGY_ID
2022-09-26 18:01:34.318 581-747/? D/ACDB-LOADER: ACDB -> send_audtable
2022-09-26 18:01:34.318 581-747/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TABLE
2022-09-26 18:01:34.318 581-747/? D/ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_CAL
2022-09-26 18:01:34.318 581-747/? D/ACDB-LOADER: ACDB -> send_audvoltable
2022-09-26 18:01:34.318 581-747/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_GAIN_DEP_STEP_TABLE
2022-09-26 18:01:34.318 581-747/? D/ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_VOL_CAL
2022-09-26 18:01:34.318 581-747/? D/ACDB-LOADER: ACDB -> send_afe_cal
2022-09-26 18:01:34.318 581-747/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AFE_COMMON_TABLE
2022-09-26 18:01:34.318 581-747/? D/ACDB-LOADER: ACDB -> AUDIO_SET_AFE_CAL
2022-09-26 18:01:34.318 581-747/? D/ACDB-LOADER: ACDB -> send_hw_delay : acdb_id = 14 path = 0
2022-09-26 18:01:34.318 581-747/? D/ACDB-LOADER: ACDB -> ACDB_AVSYNC_INFO: ACDB_CMD_GET_DEVICE_PROPERTY
2022-09-26 18:01:34.319 581-747/? I/audio_hw_utils: audio_extn_utils_send_app_type_cfg app_type 69936, acdb_dev_id 14, sample_rate 48000
2022-09-26 18:01:34.319 581-747/? D/audio_hw_primary: enable_audio_route: apply mixer and update path: low-latency-playback
2022-09-26 18:01:34.320 581-747/? D/audio_hw_primary: select_devices: done
2022-09-26 18:01:34.321 581-747/? D/msm8974_platform: platform_set_channel_map mixer_ctl_name:Playback Channel Map15
2022-09-26 18:01:34.321 581-747/? D/msm8974_platform: platform_set_channel_map: set mapping(1 2 0 0 0 0 0 0) for channel:2
2022-09-26 18:01:34.334 949-1540/? D/ActivityTrigger: ActivityTrigger activityPauseTrigger 
2022-09-26 18:01:34.377 581-747/? D/audio_hw_primary: start_output_stream: exit
2022-09-26 18:01:34.450 1087-1233/? D/OpenGLRenderer: endAllActiveAnimators on 0x7f80172400 (RippleDrawable) with handle 0x7f7fc65fa0
2022-09-26 18:01:34.485 1691-1702/? I/UsbPermissionProvider: call(UsbPermissionProvider.java:27)[Binder:1691_1]: +call method: hasPermission
2022-09-26 18:01:34.486 1691-1702/? I/UsbPermissionProvider: isAllowed(UsbPermissionProvider.java:58)[Binder:1691_1]: Package name: com.example.usbchecker, USB device: UsbDevice[mName=/dev/bus/usb/001/007,mVendorId=1273,mProductId=8349,mClass=0,mSubclass=0,mProtocol=0,mManufacturerName=Brother,mProductName=QL-820NWB,mVersion=1.16,mSerialNumber=000M6Z357427,mConfigurations=[
    UsbConfiguration[mId=1,mName=null,mAttributes=192,mMaxPower=0,mInterfaces=[
    UsbInterface[mId=0,mAlternateSetting=0,mName=null,mClass=7,mSubclass=1,mProtocol=2,mEndpoints=[
    UsbEndpoint[mAddress=129,mAttributes=2,mMaxPacketSize=64,mInterval=1]
    UsbEndpoint[mAddress=2,mAttributes=2,mMaxPacketSize=64,mInterval=1]]
    UsbInterface[mId=0,mAlternateSetting=1,mName=null,mClass=7,mSubclass=1,mProtocol=4,mEndpoints=[
    UsbEndpoint[mAddress=1,mAttributes=2,mMaxPacketSize=64,mInterval=1]
    UsbEndpoint[mAddress=130,mAttributes=2,mMaxPacketSize=64,mInterval=1]]
    UsbInterface[mId=1,mAlternateSetting=0,mName=null,mClass=255,mSubclass=1,mProtocol=0,mEndpoints=[
    UsbEndpoint[mAddress=131,mAttributes=3,mMaxPacketSize=16,mInterval=2]]
    UsbInterface[mId=1,mAlternateSetting=1,mName=null,mClass=7,mSubclass=1,mProtocol=4,mEndpoints=[
    UsbEndpoint[mAddress=3,mAttributes=2,mMaxPacketSize=64,mInterval=1]
    UsbEndpoint[mAddress=132,mAttributes=2,mMaxPacketSize=64,mInterval=1]]]]
2022-09-26 18:01:34.498 1691-1702/? I/UsbPermissions: newInstance(UsbPermissions.java:51)[Binder:1691_1]: New USB permissions instance: com.clover.engine.providers.AppsUsbPermissions@436b3a6
2022-09-26 18:01:34.503 1691-1702/? I/AppsUsbPermissions: isAllowed(UsbPermissions.java:86)[Binder:1691_1]: Checking URI: content://com.clover.apps_v3/app_usb_device
2022-09-26 18:01:34.504 1691-1702/? I/AppsUsbPermissions: isAllowed(UsbPermissions.java:88)[Binder:1691_1]: Package name: com.example.usbchecker, USB device: 0x04F9,0x209D, allowed? false

Although I give the access, isAllowed seems to be marked as false.

Please assist.

clover developer communityClover Station
1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

Is that USB device whitelisted? USB peripherals must be whitelisted.

0 Likes 0 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community