UVCIOC_CTRL_MAP not work
Hi,
# Environment:
OS = Ubuntu 22.04 LTS (Linux version 5.19.0-41-generic) Program Language = C Language
# Overview:
We plug in our UVC camera to PC, and try to use UVCIOC_CTRL_MAP function on PC to create the v4l2 control mapping, but we got error UVCIOC_CTRL_MAP: Inappropriate ioctl for device Development with C language in Ubuntu 22.04 LTS
# Description:
We have a custom UVC camera and we can modify the extension unit(XU) by ourself. (USB descriptions reference attachments uvc_xu_descriptor.PNG & usb_decriptions.txt)
We make sure that UVCIOC_CTRL_QUERY is work to control our XU item (demo code in attachment uvc_xu_ioctl_demo.c)
but UVCIOC_CTRL_MAP function fail with error message UVCIOC_CTRL_MAP: Inappropriate ioctl for device (demo code in attachment uvc_xu_v4l_mapping_demo.c)
# Problems:
1. Is UVCIOC_CTRL_MAP function using in the PC host?
2. Can you found any syntax problem in our demo code uvc_xu_v4l_mapping_demo.c?
3. Is there any sample code about struct uvc_xu_control_mapping using?
Looking forward to your reply,
Best Regards,
Hardy#2374
*****CONFIDENTIAL INFORMATION*****
This email is intended only for the use of the person or entity to whom it is addressed and contains information that may be subject to and/or may be restricted from disclosure by contract or applicable law. If you are not the intended recipient of this email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the sender that you have received this in error by replying to this message. Then, please delete it from your system. Our Privacy Policy is available here
https://www.msi.com/page/privacy-policy. Thank you.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/usb/video.h>
#include <linux/uvcvideo.h>
#include <linux/videodev2.h>
#define XU_QUERY_SIZE 0x3C
char originStr[XU_QUERY_SIZE];
char modifyStr[XU_QUERY_SIZE] = "Test123";
bool getUVC_XU_DemoString(char* buf, int size);
bool setUVC_XU_DemoString(char* buf, int size);
int main(int argc, char **argv)
{
if(getUVC_XU_DemoString(originStr, XU_QUERY_SIZE)){
printf("XU GET: %s\n", originStr);
}
if(setUVC_XU_DemoString(modifyStr, XU_QUERY_SIZE)){
printf("XU SET: %s\n", modifyStr);
}
if(getUVC_XU_DemoString(modifyStr, XU_QUERY_SIZE)){
printf("XU GET: %s\n", modifyStr);
}
if(setUVC_XU_DemoString(originStr, XU_QUERY_SIZE)){
printf("XU SET: %s\n", originStr);
}
return 0;
}bool getUVC_XU_DemoString(char* buf, int size){
int fd = open("/dev/video0", O_RDWR);
bool result = true;
if(fd < 0) {
perror("File Open Fail");
result = false;
goto ret;
}
if(size < XU_QUERY_SIZE){
perror("Invalid buffer size");
result = false;
goto ret;
}
struct uvc_xu_control_query query = {
.query = UVC_GET_CUR,
.unit = 0x4,
.selector = 0x01,
.size = XU_QUERY_SIZE,
.data = (unsigned char*)malloc(XU_QUERY_SIZE),
};
if (ioctl(fd, UVCIOC_CTRL_QUERY, &query) < 0) {
perror("UVCIOC_CTRL_QUERY");
result = false;
goto ret;
}
memcpy(buf, query.data, query.size);
free(query.data);
ret:
close(fd);
return result;
}bool setUVC_XU_DemoString(char* buf, int size){
int fd = open("/dev/video0", O_RDWR);
bool result = true;
if(fd < 0) {
perror("File Open Fail");
result = false;
goto ret;
}
if(size > XU_QUERY_SIZE){
perror("Invalid buffer size");
result = false;
goto ret;
}
struct uvc_xu_control_query query = {
.query = UVC_SET_CUR,
.unit = 0x4,
.selector = 0x01,
.size = XU_QUERY_SIZE,
.data = (unsigned char*)malloc(XU_QUERY_SIZE),
};
memcpy(query.data, buf, size);
if (ioctl(fd, UVCIOC_CTRL_QUERY, &query) < 0) {
perror("UVCIOC_CTRL_QUERY");
result = false;
goto ret;
}
free(query.data);
ret:
close(fd);
return result;
}#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/usb/video.h>
#include <linux/uvcvideo.h>
#include <linux/videodev2.h>
int main(){
int result;
int fd = open("/dev/video0", O_RDWR);
if(fd < 0) {
perror("File Open Fail");
goto close;
}
struct uvc_xu_control_mapping mapping = {
.id = 0x01,
.name = "My Extension Unit",
.entity = {0x10, 0xbc, 0x46, 0xba, 0x28, 0x5a, 0x4d, 0x7b, 0x97, 0x0e, 0xfd, 0x91, 0x46, 0xa5, 0x2f, 0x2d},
.selector = 0x01,
.size = 0x3C,
.offset = 0x00,
.v4l2_type = V4L2_CTRL_TYPE_STRING,
.data_type = UVC_CTRL_DATA_TYPE_RAW,
.menu_info = NULL,
.menu_count = 0,
.reserved = {0},
};
result = ioctl(fd, _IOWR('u', 0x20, struct uvc_xu_control_mapping), &mapping);
if (result != 0) {
perror("UVCIOC_CTRL_MAP");
goto close;
}
close:
close(fd);
return 0;
}Bus 001 Device 002: ID 2245:1230 Aspeed Technology, Inc. Cupola360 Camera
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.10
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x2245 Aspeed Technology, Inc.
idProduct 0x1230
bcdDevice 1.00
iManufacturer 1 ASPEED Technology Inc.
iProduct 2 Cupola360 Camera
iSerial 3 123456
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x02b8
bNumInterfaces 8
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 500mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 14 Video
bFunctionSubClass 3 Video Interface Collection
bFunctionProtocol 0
iFunction 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 1 Video Control
bInterfaceProtocol 0
iInterface 0
VideoControl Interface Descriptor:
bLength 13
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdUVC 1.00
wTotalLength 0x006d
dwClockFrequency 1.000000MHz
bInCollection 1
baInterfaceNr( 0) 1
VideoControl Interface Descriptor:
bLength 18
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 1
wTerminalType 0x0201 Camera Sensor
bAssocTerminal 0
iTerminal 0
wObjectiveFocalLengthMin 0
wObjectiveFocalLengthMax 0
wOcularFocalLength 0
bControlSize 3
bmControls 0x00000a0e
Auto-Exposure Mode
Auto-Exposure Priority
Exposure Time (Absolute)
Zoom (Absolute)
PanTilt (Absolute)
VideoControl Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 5 (PROCESSING_UNIT)
Warning: Descriptor too short
bUnitID 2
bSourceID 1
wMaxMultiplier 16384
bControlSize 2
bmControls 0x0000157b
Brightness
Contrast
Saturation
Sharpness
Gamma
White Balance Temperature
Backlight Compensation
Power Line Frequency
White Balance Temperature, Auto
iProcessing 0
bmVideoStandards 0x1d
None
PAL - 625/50
SECAM - 625/50
NTSC - 625/50
VideoControl Interface Descriptor:
bLength 29
bDescriptorType 36
bDescriptorSubtype 6 (EXTENSION_UNIT)
bUnitID 3
guidExtensionCode {c11e4cc3-68f9-4b92-aca4-2d73c4d49348}
bNumControls 32
bNrInPins 1
baSourceID( 0) 2
bControlSize 4
bmControls( 0) 0x01
bmControls( 1) 0x00
bmControls( 2) 0x00
bmControls( 3) 0x00
iExtension 0
VideoControl Interface Descriptor:
bLength 29
bDescriptorType 36
bDescriptorSubtype 6 (EXTENSION_UNIT)
bUnitID 4
guidExtensionCode {10bc46ba-285a-4d7b-970e-fd9146a52f2d}
bNumControls 32
bNrInPins 1
baSourceID( 0) 3
bControlSize 4
bmControls( 0) 0x01
bmControls( 1) 0x00
bmControls( 2) 0x00
bmControls( 3) 0x00
iExtension 0
VideoControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 6
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bSourceID 4
iTerminal 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x85 EP 5 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 8
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
VideoStreaming Interface Descriptor:
bLength 15
bDescriptorType 36
bDescriptorSubtype 1 (INPUT_HEADER)
bNumFormats 2
wTotalLength 0x0107
bEndpointAddress 0x81 EP 1 IN
bmInfo 0
bTerminalLink 6
bStillCaptureMethod 0
bTriggerSupport 0
bTriggerUsage 0
bControlSize 1
bmaControls( 0) 0
bmaControls( 1) 0
VideoStreaming Interface Descriptor:
bLength 27
bDescriptorType 36
bDescriptorSubtype 4 (FORMAT_UNCOMPRESSED)
bFormatIndex 1
bNumFrameDescriptors 1
guidFormat {32595559-0000-0010-8000-00aa00389b71}
bBitsPerPixel 16
bDefaultFrameIndex 1
bAspectRatioX 0
bAspectRatioY 0
bmInterlaceFlags 0x00
Interlaced stream or variable: No
Fields per frame: 2 fields
Field 1 first: No
Field pattern: Field 1 only
bCopyProtect 0
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 5 (FRAME_UNCOMPRESSED)
bFrameIndex 1
bmCapabilities 0x00
Still image unsupported
wWidth 640
wHeight 360
dwMinBitRate 55296000
dwMaxBitRate 110592000
dwMaxVideoFrameBufferSize 460800
dwDefaultFrameInterval 333333
bFrameIntervalType 2
dwFrameInterval( 0) 333333
dwFrameInterval( 1) 666666
VideoStreaming Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 6 (FORMAT_MJPEG)
bFormatIndex 2
bNumFrameDescriptors 5
bFlags 0
Fixed-size samples: No
bDefaultFrameIndex 1
bAspectRatioX 0
bAspectRatioY 0
bmInterlaceFlags 0x00
Interlaced stream or variable: No
Fields per frame: 1 fields
Field 1 first: No
Field pattern: Field 1 only
bCopyProtect 0
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 7 (FRAME_MJPEG)
bFrameIndex 1
bmCapabilities 0x00
Still image unsupported
wWidth 1920
wHeight 1080
dwMinBitRate 248832000
dwMaxBitRate 497664000
dwMaxVideoFrameBufferSize 2073600
dwDefaultFrameInterval 333333
bFrameIntervalType 2
dwFrameInterval( 0) 333333
dwFrameInterval( 1) 666666
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 7 (FRAME_MJPEG)
bFrameIndex 2
bmCapabilities 0x00
Still image unsupported
wWidth 1280
wHeight 720
dwMinBitRate 110592000
dwMaxBitRate 221184000
dwMaxVideoFrameBufferSize 921600
dwDefaultFrameInterval 333333
bFrameIntervalType 2
dwFrameInterval( 0) 333333
dwFrameInterval( 1) 666666
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 7 (FRAME_MJPEG)
bFrameIndex 3
bmCapabilities 0x00
Still image unsupported
wWidth 3840
wHeight 1712
dwMinBitRate 788889600
dwMaxBitRate 1577779200
dwMaxVideoFrameBufferSize 6574080
dwDefaultFrameInterval 333333
bFrameIntervalType 2
dwFrameInterval( 0) 333333
dwFrameInterval( 1) 666666
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 7 (FRAME_MJPEG)
bFrameIndex 4
bmCapabilities 0x00
Still image unsupported
wWidth 2560
wHeight 1136
dwMinBitRate 348979200
dwMaxBitRate 697958400
dwMaxVideoFrameBufferSize 2908160
dwDefaultFrameInterval 333333
bFrameIntervalType 2
dwFrameInterval( 0) 333333
dwFrameInterval( 1) 666666
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 7 (FRAME_MJPEG)
bFrameIndex 5
bmCapabilities 0x00
Still image unsupported
wWidth 2560
wHeight 1440
dwMinBitRate 442368000
dwMaxBitRate 884736000
dwMaxVideoFrameBufferSize 3686400
dwDefaultFrameInterval 333333
bFrameIntervalType 2
dwFrameInterval( 0) 333333
dwFrameInterval( 1) 666666
VideoStreaming Interface Descriptor:
bLength 6
bDescriptorType 36
bDescriptorSubtype 13 (COLORFORMAT)
bColorPrimaries 1 (BT.709,sRGB)
bTransferCharacteristics 1 (BT.709)
bMatrixCoefficients 4 (SMPTE 170M (BT.601))
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 2
bInterfaceCount 3
bFunctionClass 1 Audio
bFunctionSubClass 0
bFunctionProtocol 0
iFunction 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 1 Control Device
bInterfaceProtocol 0
iInterface 9 Cupola360 Audio
AudioControl Interface Descriptor:
bLength 10
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdADC 1.00
wTotalLength 0x003e
bInCollection 2
baInterfaceNr(0) 3
baInterfaceNr(1) 4
AudioControl Interface Descriptor:
bLength 12
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 1
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bNrChannels 2
wChannelConfig 0x0000
iChannelNames 0
iTerminal 0
AudioControl Interface Descriptor:
bLength 10
bDescriptorType 36
bDescriptorSubtype 6 (FEATURE_UNIT)
bUnitID 2
bSourceID 1
bControlSize 1
bmaControls(0) 0x03
Mute Control
Volume Control
bmaControls(1) 0x00
bmaControls(2) 0x00
iFeature 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 3
wTerminalType 0x0301 Speaker
bAssocTerminal 0
bSourceID 2
iTerminal 0
AudioControl Interface Descriptor:
bLength 12
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 17
wTerminalType 0x0201 Microphone
bAssocTerminal 0
bNrChannels 1
wChannelConfig 0x0000
iChannelNames 0
iTerminal 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 19
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bSourceID 17
iTerminal 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 4 Speaker
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 1
bNumEndpoints 1
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 4 Speaker
AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 1
bDelay 1 frames
wFormatTag 0x0001 PCM
AudioStreaming Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 2
bSubframeSize 2
bBitResolution 16
bSamFreqType 1 Discrete
tSamFreq[ 0] 48000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 9
Transfer Type Isochronous
Synch Type Adaptive
Usage Type Data
wMaxPacketSize 0x00c0 1x 192 bytes
bInterval 4
bRefresh 0
bSynchAddress 0
AudioStreaming Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 1 Milliseconds
wLockDelay 0x0001
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 4
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 5 Microphone
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 4
bAlternateSetting 1
bNumEndpoints 1
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 5 Microphone
AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 19
bDelay 1 frames
wFormatTag 0x0001 PCM
AudioStreaming Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 1
bSubframeSize 2
bBitResolution 16
bSamFreqType 1 Discrete
tSamFreq[ 0] 16000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x86 EP 6 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0024 1x 36 bytes
bInterval 4
bRefresh 0
bSynchAddress 0
AudioStreaming Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 0 Undefined
wLockDelay 0x0001
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 5
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 8 AstStream
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 6
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 7 HidExtension
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.11
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 38
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x89 EP 9 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 7
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 11 HidCustom
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.11
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 38
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x04 EP 4 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 4
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 4
Binary Object Store Descriptor:
bLength 5
bDescriptorType 15
wTotalLength 0x0032
bNumDeviceCaps 3
Platform Device Capability:
bLength 28
bDescriptorType 16
bDevCapabilityType 5
bReserved 0
PlatformCapabilityUUID {d8dd60df-4589-4cc7-9cd2-659d9e648a9f}
CapabilityData[0] 0x00
CapabilityData[1] 0x00
CapabilityData[2] 0x03
CapabilityData[3] 0x06
CapabilityData[4] 0xb2
CapabilityData[5] 0x00
CapabilityData[6] 0x01
CapabilityData[7] 0x00USB 2.0 Extension Device Capability:
bLength 7
bDescriptorType 16
bDevCapabilityType 2
bmAttributes 0x0000050e
BESL Link Power Management (LPM) Supported
BESL value 1280 us
SuperSpeed USB Device Capability:
bLength 10
bDescriptorType 16
bDevCapabilityType 3
bmAttributes 0x00
wSpeedsSupported 0x000c
Device can operate at High Speed (480Mbps)
Device can operate at SuperSpeed (5Gbps)
bFunctionalitySupport 2
Lowest fully-functional device speed is High Speed (480Mbps)
bU1DevExitLat 10 micro seconds
bU2DevExitLat 511 micro seconds
Device Status: 0x0000
(Bus Powered)
Hi Hardy
Why are you using:
result = ioctl(fd, _IOWR('u', 0x20, struct uvc_xu_control_mapping), &mapping);
instead of
result = ioctl(fd, UVCIOC_CTRL_MAP, &mapping);
Can you return the output of:
strace -f uvc_xu_v4l_mapping_demo
Thanks!
Quoted 42 lines · hardycheng(鄭易昕)
Hi,
# Environment:
OS = Ubuntu 22.04 LTS (Linux version 5.19.0-41-generic) Program Language = C Language
# Overview:
We plug in our UVC camera to PC, and try to use
UVCIOC_CTRL_MAPfunction on PC to create the v4l2 control mapping, but we got errorUVCIOC_CTRL_MAP: Inappropriate ioctl for deviceDevelopment withC languageinUbuntu 22.04 LTS# Description:
We have a custom UVC camera and we can modify the extension unit(XU) by ourself. (USB descriptions reference attachments
uvc_xu_descriptor.PNG&usb_decriptions.txt)We make sure that
UVCIOC_CTRL_QUERYis work to control our XU item (demo code in attachmentuvc_xu_ioctl_demo.c)but
UVCIOC_CTRL_MAPfunction fail with error messageUVCIOC_CTRL_MAP: Inappropriate ioctl for device(demo code in attachmentuvc_xu_v4l_mapping_demo.c)# Problems:
1. Is UVCIOC_CTRL_MAP function using in the PC host? 2. Can you found any syntax problem in our demo code `uvc_xu_v4l_mapping_demo.c`? 3. Is there any sample code about struct `uvc_xu_control_mapping` using?Looking forward to your reply,
Best Regards,
Hardy#2374*****CONFIDENTIAL INFORMATION*****
This email is intended only for the use of the person or entity to whom it is addressed and contains information that may be subject to and/or may be restricted from disclosure by contract or applicable law. If you are not the intended recipient of this email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the sender that you have received this in error by replying to this message. Then, please delete it from your system. Our Privacy Policy is available here
https://www.msi.com/page/privacy-policy. Thank you.
Signature · 1 line
Ricardo Ribalda
Hi Ricardo,
Thanks for reply,
I replace _IOWR('u', 0x20, struct uvc_xu_control_mapping) to UVCIOC_CTRL_MAP and got the same error, Please check attachment for command output strace -f ./uvc_xu_v4l_mapping_demo
Best Regards,
Hardy
-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:04 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re: UVCIOC_CTRL_MAP not work
Hi Hardy
Why are you using:
result = ioctl(fd, _IOWR('u', 0x20, struct uvc_xu_control_mapping), &mapping);
instead of
result = ioctl(fd, UVCIOC_CTRL_MAP, &mapping);
Can you return the output of:
strace -f uvc_xu_v4l_mapping_demo
Thanks!
Quoted 40 lines · hardycheng(鄭易昕)
Hi,
# Environment:
OS = Ubuntu 22.04 LTS (Linux version 5.19.0-41-generic) Program Language = C Language
# Overview:
We plug in our UVC camera to PC, and try to use
UVCIOC_CTRL_MAPfunction on PC to create the v4l2 control mapping, but we got errorUVCIOC_CTRL_MAP: Inappropriate ioctl for deviceDevelopment withC languageinUbuntu 22.04 LTS# Description:
We have a custom UVC camera and we can modify the extension unit(XU) by ourself. (USB descriptions reference attachments
uvc_xu_descriptor.PNG&usb_decriptions.txt)We make sure that
UVCIOC_CTRL_QUERYis work to control our XU item (demo code in attachmentuvc_xu_ioctl_demo.c)but
UVCIOC_CTRL_MAPfunction fail with error message `UVCIOC_CTRL_MAP:
Inappropriate ioctl for device(demo code in attachmentuvc_xu_v4l_mapping_demo.c`)# Problems:
1. Is UVCIOC_CTRL_MAP function using in the PC host? 2. Can you found any syntax problem in our demo code `uvc_xu_v4l_mapping_demo.c`? 3. Is there any sample code about struct `uvc_xu_control_mapping` using?Looking forward to your reply,
Best Regards,
Hardy#2374*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject to
and/or may be restricted from disclosure by contract or applicable
law. If you are not the intended recipient of this email, be advised
that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the
sender that you have received this in error by replying to this
message. Then, please delete it from your system. Our Privacy Policy
is available here https://www.msi.com/page/privacy-policy. Thank you.
--
Ricardo Ribalda
*****CONFIDENTIAL INFORMATION*****
This email is intended only for the use of the person or entity to whom it is addressed and contains information that may be subject to and/or may be restricted from disclosure by contract or applicable law. If you are not the intended recipient of this email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the sender that you have received this in error by replying to this message. Then, please delete it from your system. Our Privacy Policy is available here
https://www.msi.com/page/privacy-policy. Thank you.
root@ubuntu22:/ms5548_test# strace -f ./uvc_xu_v4l_mapping_demo
execve("./uvc_xu_v4l_mapping_demo", ["./uvc_xu_v4l_mapping_demo"], 0x7fff9c969de8 /* 76 vars */) = 0
brk(NULL) = 0x55baa8504000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffc59064f70) = -1 EINVAL (Invalid argument)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb94c41f000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=65987, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 65987, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb94c40e000
close(3) = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\237\2\0\0\0\0\0"..., 832) = 832
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
pread64(3, "\4\0\0\0 \0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0"..., 48, 848) = 48
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0i8\235HZ\227\223\333\350s\360\352,\223\340."..., 68, 896) = 68
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=2216304, ...}, AT_EMPTY_PATH) = 0
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
mmap(NULL, 2260560, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb94c000000
mmap(0x7fb94c028000, 1658880, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x28000) = 0x7fb94c028000
mmap(0x7fb94c1bd000, 360448, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bd000) = 0x7fb94c1bd000
mmap(0x7fb94c215000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x214000) = 0x7fb94c215000
mmap(0x7fb94c21b000, 52816, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fb94c21b000
close(3) = 0
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb94c40b000
arch_prctl(ARCH_SET_FS, 0x7fb94c40b740) = 0
set_tid_address(0x7fb94c40ba10) = 6285
set_robust_list(0x7fb94c40ba20, 24) = 0
rseq(0x7fb94c40c0e0, 0x20, 0, 0x53053053) = 0
mprotect(0x7fb94c215000, 16384, PROT_READ) = 0
mprotect(0x55baa6c47000, 4096, PROT_READ) = 0
mprotect(0x7fb94c459000, 8192, PROT_READ) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
munmap(0x7fb94c40e000, 65987) = 0
openat(AT_FDCWD, "/dev/video0", O_RDWR) = 3
ioctl(3, UVCIOC_CTRL_MAP, 0x7ffc59064fb0) = -1 ENOTTY (Inappropriate ioctl for device)
dup(2) = 4
fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)
getrandom("\x87\xd1\x7a\x35\xc1\x4e\xa8\x44", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x55baa8504000
brk(0x55baa8525000) = 0x55baa8525000
newfstatat(4, "", {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0), ...}, AT_EMPTY_PATH) = 0
write(4, "UVCIOC_CTRL_MAP: Inappropriate i"..., 48UVCIOC_CTRL_MAP: Inappropriate ioctl for device
) = 48
close(4) = 0
close(3) = 0
exit_group(0) = ?
+++ exited with 0 +++Hi Hardy
Seems like you can only add mappings for V4L2_CTRL_TYPE_INTEGER, V4L2_CTRL_TYPE_BOOLEAN:V4L2_CTRL_TYPE_BUTTON and V4L2_CTRL_TYPE_MENU.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/media/usb/uvc/uvc_v4l2.c#n130
You are trying to add a map for a V4L2_CTRL_TYPE_STRING
Regards
Quoted 102 lines · hardycheng(鄭易昕)
Hi Ricardo,
Thanks for reply,
I replace
_IOWR('u', 0x20, struct uvc_xu_control_mapping)toUVCIOC_CTRL_MAPand got the same error, Please check attachment for command outputstrace -f ./uvc_xu_v4l_mapping_demoBest Regards,
Hardy-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:04 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
Why are you using:
result =
ioctl(fd, _IOWR('u', 0x20, struct uvc_xu_control_mapping), &mapping);instead of
result =
ioctl(fd, UVCIOC_CTRL_MAP, &mapping);Can you return the output of:
strace -f
uvc_xu_v4l_mapping_demoThanks!
Quoted 40 lines · hardycheng(鄭易昕)
Hi,
# Environment:
OS = Ubuntu 22.04 LTS (Linux version 5.19.0-41-generic) Program Language = C Language
# Overview:
We plug in our UVC camera to PC, and try to use
UVCIOC_CTRL_MAPfunction on PC to create the v4l2 control mapping, but we got errorUVCIOC_CTRL_MAP: Inappropriate ioctl for deviceDevelopment withC languageinUbuntu 22.04 LTS# Description:
We have a custom UVC camera and we can modify the extension unit(XU) by ourself. (USB descriptions reference attachments
uvc_xu_descriptor.PNG&usb_decriptions.txt)We make sure that
UVCIOC_CTRL_QUERYis work to control our XU item (demo code in attachmentuvc_xu_ioctl_demo.c)but
UVCIOC_CTRL_MAPfunction fail with error message `UVCIOC_CTRL_MAP:
Inappropriate ioctl for device(demo code in attachmentuvc_xu_v4l_mapping_demo.c`)# Problems:
1. Is UVCIOC_CTRL_MAP function using in the PC host? 2. Can you found any syntax problem in our demo code `uvc_xu_v4l_mapping_demo.c`? 3. Is there any sample code about struct `uvc_xu_control_mapping` using?Looking forward to your reply,
Best Regards,
Hardy#2374*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject to
and/or may be restricted from disclosure by contract or applicable
law. If you are not the intended recipient of this email, be advised
that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the
sender that you have received this in error by replying to this
message. Then, please delete it from your system. Our Privacy Policy
is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
This email is intended only for the use of the person or entity to whom it is addressed and contains information that may be subject to and/or may be restricted from disclosure by contract or applicable law. If you are not the intended recipient of this email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the sender that you have received this in error by replying to this message. Then, please delete it from your system. Our Privacy Policy is available here
https://www.msi.com/page/privacy-policy. Thank you.
Signature · 1 line
Ricardo Ribalda
Hi Ricardo,
So I modify the uvc_xu_control_mapping struct as follows:
(full code reference attachment uvc_xu_v4l_mapping_demo.c)
struct uvc_xu_control_mapping mapping = {
.id = 0x01,
.name = "My Extension Unit",
.entity = {0x10, 0xbc, 0x46, 0xba, 0x28, 0x5a, 0x4d, 0x7b, 0x97, 0x0e, 0xfd, 0x91, 0x46, 0xa5, 0x2f, 0x2d},
.selector = 0x01,
.size = 32,
.offset = 0,
.v4l2_type = V4L2_CTRL_TYPE_INTEGER,
.data_type = UVC_CTRL_DATA_TYPE_UNSIGNED,
.menu_info = NULL,
.menu_count = 0,
.reserved = {0},
};And I got difference error message UVCIOC_CTRL_MAP: No such file or directory Please check attachment strace_20230428_2.log for strace output
Best Regards,
Hardy
-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:26 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re: UVCIOC_CTRL_MAP not work
Hi Hardy
Seems like you can only add mappings for V4L2_CTRL_TYPE_INTEGER, V4L2_CTRL_TYPE_BOOLEAN:V4L2_CTRL_TYPE_BUTTON and V4L2_CTRL_TYPE_MENU.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/media/usb/uvc/uvc_v4l2.c#n130
You are trying to add a map for a V4L2_CTRL_TYPE_STRING
Regards
Quoted 95 lines · hardycheng(鄭易昕)
Hi Ricardo,
Thanks for reply,
I replace
_IOWR('u', 0x20, struct uvc_xu_control_mapping)toUVCIOC_CTRL_MAPand got the same error, Please check attachment for command outputstrace -f ./uvc_xu_v4l_mapping_demoBest Regards,
Hardy-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:04 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
Why are you using:
result =
ioctl(fd, _IOWR('u', 0x20, struct uvc_xu_control_mapping), &mapping);instead of
result =
ioctl(fd, UVCIOC_CTRL_MAP, &mapping);Can you return the output of:
strace -f
uvc_xu_v4l_mapping_demoThanks!
Quoted 40 lines · hardycheng(鄭易昕)
Hi,
# Environment:
OS = Ubuntu 22.04 LTS (Linux version 5.19.0-41-generic) Program Language = C Language
# Overview:
We plug in our UVC camera to PC, and try to use
UVCIOC_CTRL_MAPfunction on PC to create the v4l2 control mapping, but we got errorUVCIOC_CTRL_MAP: Inappropriate ioctl for deviceDevelopment withC languageinUbuntu 22.04 LTS# Description:
We have a custom UVC camera and we can modify the extension unit(XU) by ourself. (USB descriptions reference attachments
uvc_xu_descriptor.PNG&usb_decriptions.txt)We make sure that
UVCIOC_CTRL_QUERYis work to control our XU item (demo code in attachmentuvc_xu_ioctl_demo.c)but
UVCIOC_CTRL_MAPfunction fail with error message `UVCIOC_CTRL_MAP:
Inappropriate ioctl for device(demo code in attachmentuvc_xu_v4l_mapping_demo.c`)# Problems:
1. Is UVCIOC_CTRL_MAP function using in the PC host? 2. Can you found any syntax problem in our demo code `uvc_xu_v4l_mapping_demo.c`? 3. Is there any sample code about struct `uvc_xu_control_mapping` using?Looking forward to your reply,
Best Regards,
Hardy#2374*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject to
and/or may be restricted from disclosure by contract or applicable
law. If you are not the intended recipient of this email, be advised
that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify
the sender that you have received this in error by replying to this
message. Then, please delete it from your system. Our Privacy Policy
is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject to
and/or may be restricted from disclosure by contract or applicable
law. If you are not the intended recipient of this email, be advised
that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the
sender that you have received this in error by replying to this
message. Then, please delete it from your system. Our Privacy Policy
is available here https://www.msi.com/page/privacy-policy. Thank you.
--
Ricardo Ribalda
*****CONFIDENTIAL INFORMATION*****
This email is intended only for the use of the person or entity to whom it is addressed and contains information that may be subject to and/or may be restricted from disclosure by contract or applicable law. If you are not the intended recipient of this email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the sender that you have received this in error by replying to this message. Then, please delete it from your system. Our Privacy Policy is available here
https://www.msi.com/page/privacy-policy. Thank you.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/usb/video.h>
#include <linux/uvcvideo.h>
#include <linux/videodev2.h>
int main(){
int result;
int fd = open("/dev/video0", O_RDWR);
if(fd < 0) {
perror("File Open Fail");
goto close;
}
struct uvc_xu_control_mapping mapping = {
.id = 0x01,
.name = "My Extension Unit",
.entity = {0x10, 0xbc, 0x46, 0xba, 0x28, 0x5a, 0x4d, 0x7b, 0x97, 0x0e, 0xfd, 0x91, 0x46, 0xa5, 0x2f, 0x2d},
.selector = 0x01,
.size = 32,
.offset = 0,
.v4l2_type = V4L2_CTRL_TYPE_INTEGER,
.data_type = UVC_CTRL_DATA_TYPE_UNSIGNED,
.menu_info = NULL,
.menu_count = 0,
.reserved = {0},
};
result = ioctl(fd, UVCIOC_CTRL_MAP, &mapping);
if (result != 0) {
perror("UVCIOC_CTRL_MAP");
goto close;
}
close:
close(fd);
return 0;
}
root@ubuntu22:/ms5548_test# strace -f ./uvc_xu_v4l_mapping_demo
execve("./uvc_xu_v4l_mapping_demo", ["./uvc_xu_v4l_mapping_demo"], 0x7fff918670d8 /* 76 vars */) = 0
brk(NULL) = 0x55a9e3bd7000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffdcb619c10) = -1 EINVAL (Invalid argument)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2dffcff000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=65987, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 65987, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2dffcee000
close(3) = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\237\2\0\0\0\0\0"..., 832) = 832
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
pread64(3, "\4\0\0\0 \0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0"..., 48, 848) = 48
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0i8\235HZ\227\223\333\350s\360\352,\223\340."..., 68, 896) = 68
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=2216304, ...}, AT_EMPTY_PATH) = 0
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
mmap(NULL, 2260560, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2dffa00000
mmap(0x7f2dffa28000, 1658880, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x28000) = 0x7f2dffa28000
mmap(0x7f2dffbbd000, 360448, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bd000) = 0x7f2dffbbd000
mmap(0x7f2dffc15000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x214000) = 0x7f2dffc15000
mmap(0x7f2dffc1b000, 52816, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2dffc1b000
close(3) = 0
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2dffceb000
arch_prctl(ARCH_SET_FS, 0x7f2dffceb740) = 0
set_tid_address(0x7f2dffceba10) = 6662
set_robust_list(0x7f2dffceba20, 24) = 0
rseq(0x7f2dffcec0e0, 0x20, 0, 0x53053053) = 0
mprotect(0x7f2dffc15000, 16384, PROT_READ) = 0
mprotect(0x55a9e30a1000, 4096, PROT_READ) = 0
mprotect(0x7f2dffd39000, 8192, PROT_READ) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
munmap(0x7f2dffcee000, 65987) = 0
openat(AT_FDCWD, "/dev/video0", O_RDWR) = 3
ioctl(3, UVCIOC_CTRL_MAP, 0x7ffdcb619c50) = -1 ENOENT (No such file or directory)
dup(2) = 4
fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)
getrandom("\xab\x1f\x34\x15\xb8\x09\x28\x79", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x55a9e3bd7000
brk(0x55a9e3bf8000) = 0x55a9e3bf8000
newfstatat(4, "", {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0), ...}, AT_EMPTY_PATH) = 0
write(4, "UVCIOC_CTRL_MAP: No such file or"..., 43UVCIOC_CTRL_MAP: No such file or directory
) = 43
close(4) = 0
close(3) = 0
exit_group(0) = ?
+++ exited with 0 +++Hi Hardy
try running:
echo 0xffffffff > /sys/module/uvcvideo/parameters/trace
and then your program
and then dmesg
It will tell you where it got stock
Regards!
Quoted 166 lines · hardycheng(鄭易昕)
Hi Ricardo,
So I modify the
uvc_xu_control_mappingstruct as follows:
(full code reference attachmentuvc_xu_v4l_mapping_demo.c)struct uvc_xu_control_mapping mapping = { .id = 0x01, .name = "My Extension Unit", .entity = {0x10, 0xbc, 0x46, 0xba, 0x28, 0x5a, 0x4d, 0x7b, 0x97, 0x0e, 0xfd, 0x91, 0x46, 0xa5, 0x2f, 0x2d}, .selector = 0x01, .size = 32, .offset = 0, .v4l2_type = V4L2_CTRL_TYPE_INTEGER, .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED, .menu_info = NULL, .menu_count = 0, .reserved = {0}, };And I got difference error message
UVCIOC_CTRL_MAP: No such file or directoryPlease check attachmentstrace_20230428_2.logfor strace outputBest Regards,
Hardy-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:26 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
Seems like you can only add mappings for
V4L2_CTRL_TYPE_INTEGER, V4L2_CTRL_TYPE_BOOLEAN:V4L2_CTRL_TYPE_BUTTON andV4L2_CTRL_TYPE_MENU.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/media/usb/uvc/uvc_v4l2.c#n130You are trying to add a map for a
V4L2_CTRL_TYPE_STRINGRegards
Quoted 95 lines · hardycheng(鄭易昕)
Hi Ricardo,
Thanks for reply,
I replace
_IOWR('u', 0x20, struct uvc_xu_control_mapping)toUVCIOC_CTRL_MAPand got the same error, Please check attachment for command outputstrace -f ./uvc_xu_v4l_mapping_demoBest Regards,
Hardy-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:04 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
Why are you using:
result =
ioctl(fd, _IOWR('u', 0x20, struct uvc_xu_control_mapping), &mapping);instead of
result =
ioctl(fd, UVCIOC_CTRL_MAP, &mapping);Can you return the output of:
strace -f
uvc_xu_v4l_mapping_demoThanks!
Quoted 40 lines · hardycheng(鄭易昕)
Hi,
# Environment:
OS = Ubuntu 22.04 LTS (Linux version 5.19.0-41-generic) Program Language = C Language
# Overview:
We plug in our UVC camera to PC, and try to use
UVCIOC_CTRL_MAPfunction on PC to create the v4l2 control mapping, but we got errorUVCIOC_CTRL_MAP: Inappropriate ioctl for deviceDevelopment withC languageinUbuntu 22.04 LTS# Description:
We have a custom UVC camera and we can modify the extension unit(XU) by ourself. (USB descriptions reference attachments
uvc_xu_descriptor.PNG&usb_decriptions.txt)We make sure that
UVCIOC_CTRL_QUERYis work to control our XU item (demo code in attachmentuvc_xu_ioctl_demo.c)but
UVCIOC_CTRL_MAPfunction fail with error message `UVCIOC_CTRL_MAP:
Inappropriate ioctl for device(demo code in attachmentuvc_xu_v4l_mapping_demo.c`)# Problems:
1. Is UVCIOC_CTRL_MAP function using in the PC host? 2. Can you found any syntax problem in our demo code `uvc_xu_v4l_mapping_demo.c`? 3. Is there any sample code about struct `uvc_xu_control_mapping` using?Looking forward to your reply,
Best Regards,
Hardy#2374*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject to
and/or may be restricted from disclosure by contract or applicable
law. If you are not the intended recipient of this email, be advised
that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify
the sender that you have received this in error by replying to this
message. Then, please delete it from your system. Our Privacy Policy
is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject to
and/or may be restricted from disclosure by contract or applicable
law. If you are not the intended recipient of this email, be advised
that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the
sender that you have received this in error by replying to this
message. Then, please delete it from your system. Our Privacy Policy
is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
This email is intended only for the use of the person or entity to whom it is addressed and contains information that may be subject to and/or may be restricted from disclosure by contract or applicable law. If you are not the intended recipient of this email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the sender that you have received this in error by replying to this message. Then, please delete it from your system. Our Privacy Policy is available here
https://www.msi.com/page/privacy-policy. Thank you.
Signature · 1 line
Ricardo Ribalda
Hi Ricardo,
Thank you for such a quick reply.
Follow your advice, but I just got few logs in dmesg
[ 9452.677337] usb 1-1: uvc_v4l2_open [ 9452.725254] usb 1-1: Resuming interface 0 [ 9452.725258] usb 1-1: Resuming interface 1 [ 9452.751971] usb 1-1: uvc_v4l2_release [ 9455.236973] usb 1-1: Suspending interface 1 [ 9455.236977] usb 1-1: Suspending interface 0
Is there any way to get more debug message about this issue?
Best Regards,
Hardy#2374
-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:45 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re: UVCIOC_CTRL_MAP not work
Hi Hardy
try running:
echo 0xffffffff > /sys/module/uvcvideo/parameters/trace
and then your program
and then dmesg
It will tell you where it got stock
Regards!
Quoted 160 lines · hardycheng(鄭易昕)
Hi Ricardo,
So I modify the
uvc_xu_control_mappingstruct as follows:
(full code reference attachmentuvc_xu_v4l_mapping_demo.c) structuvc_xu_control_mapping mapping = { .id = 0x01, .name = "My Extension Unit", .entity = {0x10, 0xbc, 0x46, 0xba, 0x28, 0x5a, 0x4d, 0x7b, 0x97, 0x0e, 0xfd, 0x91, 0x46, 0xa5, 0x2f, 0x2d}, .selector = 0x01, .size = 32, .offset = 0, .v4l2_type = V4L2_CTRL_TYPE_INTEGER, .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED, .menu_info = NULL, .menu_count = 0, .reserved = {0}, };And I got difference error message
UVCIOC_CTRL_MAP: No such file or directoryPlease check attachmentstrace_20230428_2.logfor strace outputBest Regards,
Hardy-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:26 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
Seems like you can only add mappings for
V4L2_CTRL_TYPE_INTEGER, V4L2_CTRL_TYPE_BOOLEAN:V4L2_CTRL_TYPE_BUTTON andV4L2_CTRL_TYPE_MENU.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tre
e/drivers/media/usb/uvc/uvc_v4l2.c#n130You are trying to add a map for a
V4L2_CTRL_TYPE_STRINGRegards
Quoted 96 lines · hardycheng(鄭易昕)
Hi Ricardo,
Thanks for reply,
I replace
_IOWR('u', 0x20, struct uvc_xu_control_mapping)toUVCIOC_CTRL_MAPand got the same error, Please check attachment for command outputstrace -f ./uvc_xu_v4l_mapping_demoBest Regards,
Hardy-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:04 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
Why are you using:
result =
ioctl(fd, _IOWR('u', 0x20, struct uvc_xu_control_mapping), &mapping);instead of
result =
ioctl(fd, UVCIOC_CTRL_MAP, &mapping);Can you return the output of:
strace -f
uvc_xu_v4l_mapping_demoThanks!
Quoted 41 lines · hardycheng(鄭易昕)
Hi,
# Environment:
OS = Ubuntu 22.04 LTS (Linux version 5.19.0-41-generic) Program Language = C Language
# Overview:
We plug in our UVC camera to PC, and try to use
UVCIOC_CTRL_MAPfunction on PC to create the v4l2 control mapping, but we got errorUVCIOC_CTRL_MAP: Inappropriate ioctl for deviceDevelopment withC languageinUbuntu 22.04 LTS# Description:
We have a custom UVC camera and we can modify the extension unit(XU) by ourself. (USB descriptions reference attachments
uvc_xu_descriptor.PNG&usb_decriptions.txt)We make sure that
UVCIOC_CTRL_QUERYis work to control our XU item (demo code in attachmentuvc_xu_ioctl_demo.c)but
UVCIOC_CTRL_MAPfunction fail with error message `UVCIOC_CTRL_MAP:
Inappropriate ioctl for device(demo code in attachmentuvc_xu_v4l_mapping_demo.c`)# Problems:
1. Is UVCIOC_CTRL_MAP function using in the PC host? 2. Can you found any syntax problem in our demo code `uvc_xu_v4l_mapping_demo.c`? 3. Is there any sample code about struct `uvc_xu_control_mapping` using?Looking forward to your reply,
Best Regards,
Hardy#2374*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject
to and/or may be restricted from disclosure by contract or
applicable law. If you are not the intended recipient of this
email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify
the sender that you have received this in error by replying to
this message. Then, please delete it from your system. Our Privacy
Policy is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject to
and/or may be restricted from disclosure by contract or applicable
law. If you are not the intended recipient of this email, be advised
that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify
the sender that you have received this in error by replying to this
message. Then, please delete it from your system. Our Privacy Policy
is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject to
and/or may be restricted from disclosure by contract or applicable
law. If you are not the intended recipient of this email, be advised
that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the
sender that you have received this in error by replying to this
message. Then, please delete it from your system. Our Privacy Policy
is available here https://www.msi.com/page/privacy-policy. Thank you.
--
Ricardo Ribalda
*****CONFIDENTIAL INFORMATION*****
This email is intended only for the use of the person or entity to whom it is addressed and contains information that may be subject to and/or may be restricted from disclosure by contract or applicable law. If you are not the intended recipient of this email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the sender that you have received this in error by replying to this message. Then, please delete it from your system. Our Privacy Policy is available here
https://www.msi.com/page/privacy-policy. Thank you.
What about:
rmmod uvcvideo
modprobe uvcvideo trace=0xffffffff
then run your program
You might be able to figure out what xu controls are discovered.
Quoted 229 lines · hardycheng(鄭易昕)
Hi Ricardo,
Thank you for such a quick reply.
Follow your advice, but I just got few logs in dmesg[ 9452.677337] usb 1-1: uvc_v4l2_open [ 9452.725254] usb 1-1: Resuming interface 0 [ 9452.725258] usb 1-1: Resuming interface 1 [ 9452.751971] usb 1-1: uvc_v4l2_release [ 9455.236973] usb 1-1: Suspending interface 1 [ 9455.236977] usb 1-1: Suspending interface 0Is there any way to get more debug message about this issue?
Best Regards,
Hardy#2374-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:45 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
try running:
echo
0xffffffff>/sys/module/uvcvideo/parameters/traceand then your program
and then dmesg
It will tell you where it got stock
Regards!
Quoted 160 lines · hardycheng(鄭易昕)
Hi Ricardo,
So I modify the
uvc_xu_control_mappingstruct as follows:
(full code reference attachmentuvc_xu_v4l_mapping_demo.c) structuvc_xu_control_mapping mapping = { .id = 0x01, .name = "My Extension Unit", .entity = {0x10, 0xbc, 0x46, 0xba, 0x28, 0x5a, 0x4d, 0x7b, 0x97, 0x0e, 0xfd, 0x91, 0x46, 0xa5, 0x2f, 0x2d}, .selector = 0x01, .size = 32, .offset = 0, .v4l2_type = V4L2_CTRL_TYPE_INTEGER, .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED, .menu_info = NULL, .menu_count = 0, .reserved = {0}, };And I got difference error message
UVCIOC_CTRL_MAP: No such file or directoryPlease check attachmentstrace_20230428_2.logfor strace outputBest Regards,
Hardy-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:26 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
Seems like you can only add mappings for
V4L2_CTRL_TYPE_INTEGER, V4L2_CTRL_TYPE_BOOLEAN:V4L2_CTRL_TYPE_BUTTON andV4L2_CTRL_TYPE_MENU.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tre
e/drivers/media/usb/uvc/uvc_v4l2.c#n130You are trying to add a map for a
V4L2_CTRL_TYPE_STRINGRegards
Quoted 96 lines · hardycheng(鄭易昕)
Hi Ricardo,
Thanks for reply,
I replace
_IOWR('u', 0x20, struct uvc_xu_control_mapping)toUVCIOC_CTRL_MAPand got the same error, Please check attachment for command outputstrace -f ./uvc_xu_v4l_mapping_demoBest Regards,
Hardy-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:04 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
Why are you using:
result =
ioctl(fd, _IOWR('u', 0x20, struct uvc_xu_control_mapping), &mapping);instead of
result =
ioctl(fd, UVCIOC_CTRL_MAP, &mapping);Can you return the output of:
strace -f
uvc_xu_v4l_mapping_demoThanks!
Quoted 41 lines · hardycheng(鄭易昕)
Hi,
# Environment:
OS = Ubuntu 22.04 LTS (Linux version 5.19.0-41-generic) Program Language = C Language
# Overview:
We plug in our UVC camera to PC, and try to use
UVCIOC_CTRL_MAPfunction on PC to create the v4l2 control mapping, but we got errorUVCIOC_CTRL_MAP: Inappropriate ioctl for deviceDevelopment withC languageinUbuntu 22.04 LTS# Description:
We have a custom UVC camera and we can modify the extension unit(XU) by ourself. (USB descriptions reference attachments
uvc_xu_descriptor.PNG&usb_decriptions.txt)We make sure that
UVCIOC_CTRL_QUERYis work to control our XU item (demo code in attachmentuvc_xu_ioctl_demo.c)but
UVCIOC_CTRL_MAPfunction fail with error message `UVCIOC_CTRL_MAP:
Inappropriate ioctl for device(demo code in attachmentuvc_xu_v4l_mapping_demo.c`)# Problems:
1. Is UVCIOC_CTRL_MAP function using in the PC host? 2. Can you found any syntax problem in our demo code `uvc_xu_v4l_mapping_demo.c`? 3. Is there any sample code about struct `uvc_xu_control_mapping` using?Looking forward to your reply,
Best Regards,
Hardy#2374*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject
to and/or may be restricted from disclosure by contract or
applicable law. If you are not the intended recipient of this
email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify
the sender that you have received this in error by replying to
this message. Then, please delete it from your system. Our Privacy
Policy is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject to
and/or may be restricted from disclosure by contract or applicable
law. If you are not the intended recipient of this email, be advised
that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify
the sender that you have received this in error by replying to this
message. Then, please delete it from your system. Our Privacy Policy
is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject to
and/or may be restricted from disclosure by contract or applicable
law. If you are not the intended recipient of this email, be advised
that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the
sender that you have received this in error by replying to this
message. Then, please delete it from your system. Our Privacy Policy
is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
This email is intended only for the use of the person or entity to whom it is addressed and contains information that may be subject to and/or may be restricted from disclosure by contract or applicable law. If you are not the intended recipient of this email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the sender that you have received this in error by replying to this message. Then, please delete it from your system. Our Privacy Policy is available here
https://www.msi.com/page/privacy-policy. Thank you.
Signature · 1 line
Ricardo Ribalda
Hi Ricardo,
Seems like no more message of XU controls,
I run my program in time [10246.557462],
the relevant message is as follows:
[10246.557462] usb 1-1: uvc_v4l2_open [10246.625260] usb 1-1: Resuming interface 0 [10246.625266] usb 1-1: Resuming interface 1 [10246.645515] usb 1-1: uvc_v4l2_release
Please check attachment of dmseg output dmesg_20230428.log
Best Regards,
Hardy#2374
-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:58 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re: UVCIOC_CTRL_MAP not work
What about:
rmmod uvcvideo
modprobe uvcvideo trace=0xffffffff
then run your program
You might be able to figure out what xu controls are discovered.
Quoted 220 lines · hardycheng(鄭易昕)
Hi Ricardo,
Thank you for such a quick reply.
Follow your advice, but I just got few logs in dmesg[ 9452.677337] usb 1-1: uvc_v4l2_open [ 9452.725254] usb 1-1: Resuming interface 0 [ 9452.725258] usb 1-1:Resuming interface 1 [ 9452.751971] usb 1-1:
uvc_v4l2_release[ 9455.236973] usb 1-1: Suspending interface 1 [ 9455.236977] usb 1-1:
Suspending interface 0Is there any way to get more debug message about this issue?
Best Regards,
Hardy#2374-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:45 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
try running:
echo
0xffffffff>/sys/module/uvcvideo/parameters/traceand then your program
and then dmesg
It will tell you where it got stock
Regards!
Quoted 161 lines · hardycheng(鄭易昕)
Hi Ricardo,
So I modify the
uvc_xu_control_mappingstruct as follows:
(full code reference attachmentuvc_xu_v4l_mapping_demo.c) structuvc_xu_control_mapping mapping = { .id = 0x01, .name = "My Extension Unit", .entity = {0x10, 0xbc, 0x46, 0xba, 0x28, 0x5a, 0x4d, 0x7b, 0x97, 0x0e, 0xfd, 0x91, 0x46, 0xa5, 0x2f, 0x2d}, .selector = 0x01, .size = 32, .offset = 0, .v4l2_type = V4L2_CTRL_TYPE_INTEGER, .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED, .menu_info = NULL, .menu_count = 0, .reserved = {0}, };And I got difference error message
UVCIOC_CTRL_MAP: No such file or directoryPlease check attachmentstrace_20230428_2.logfor strace outputBest Regards,
Hardy-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:26 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
Seems like you can only add mappings for
V4L2_CTRL_TYPE_INTEGER, V4L2_CTRL_TYPE_BOOLEAN:V4L2_CTRL_TYPE_BUTTON andV4L2_CTRL_TYPE_MENU.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/t
re
e/drivers/media/usb/uvc/uvc_v4l2.c#n130You are trying to add a map for a
V4L2_CTRL_TYPE_STRINGRegards
Quoted 96 lines · hardycheng(鄭易昕)
Hi Ricardo,
Thanks for reply,
I replace
_IOWR('u', 0x20, struct uvc_xu_control_mapping)toUVCIOC_CTRL_MAPand got the same error, Please check attachment for command outputstrace -f ./uvc_xu_v4l_mapping_demoBest Regards,
Hardy-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:04 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
Why are you using:
result = ioctl(fd, _IOWR('u',
0x20, structuvc_xu_control_mapping), &mapping);instead of
result =
ioctl(fd, UVCIOC_CTRL_MAP, &mapping);Can you return the output of:
strace -f
uvc_xu_v4l_mapping_demoThanks!
Quoted 41 lines · hardycheng(鄭易昕)
Hi,
# Environment:
OS = Ubuntu 22.04 LTS (Linux version 5.19.0-41-generic) Program Language = C Language
# Overview:
We plug in our UVC camera to PC, and try to use
UVCIOC_CTRL_MAPfunction on PC to create the v4l2 control mapping, but we got errorUVCIOC_CTRL_MAP: Inappropriate ioctl for deviceDevelopment withC languageinUbuntu 22.04 LTS# Description:
We have a custom UVC camera and we can modify the extension unit(XU) by ourself. (USB descriptions reference attachments
uvc_xu_descriptor.PNG&usb_decriptions.txt)We make sure that
UVCIOC_CTRL_QUERYis work to control our XU item (demo code in attachmentuvc_xu_ioctl_demo.c)but
UVCIOC_CTRL_MAPfunction fail with error message `UVCIOC_CTRL_MAP:
Inappropriate ioctl for device(demo code in attachmentuvc_xu_v4l_mapping_demo.c`)# Problems:
1. Is UVCIOC_CTRL_MAP function using in the PC host? 2. Can you found any syntax problem in our demo code `uvc_xu_v4l_mapping_demo.c`? 3. Is there any sample code about struct `uvc_xu_control_mapping` using?Looking forward to your reply,
Best Regards,
Hardy#2374*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity
to whom it is addressed and contains information that may be
subject to and/or may be restricted from disclosure by contract
or applicable law. If you are not the intended recipient of this
email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please
notify the sender that you have received this in error by
replying to this message. Then, please delete it from your
system. Our Privacy Policy is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject
to and/or may be restricted from disclosure by contract or
applicable law. If you are not the intended recipient of this
email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify
the sender that you have received this in error by replying to
this message. Then, please delete it from your system. Our Privacy
Policy is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject to
and/or may be restricted from disclosure by contract or applicable
law. If you are not the intended recipient of this email, be advised
that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify
the sender that you have received this in error by replying to this
message. Then, please delete it from your system. Our Privacy Policy
is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject to
and/or may be restricted from disclosure by contract or applicable
law. If you are not the intended recipient of this email, be advised
that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the
sender that you have received this in error by replying to this
message. Then, please delete it from your system. Our Privacy Policy
is available here https://www.msi.com/page/privacy-policy. Thank you.
--
Ricardo Ribalda
*****CONFIDENTIAL INFORMATION*****
This email is intended only for the use of the person or entity to whom it is addressed and contains information that may be subject to and/or may be restricted from disclosure by contract or applicable law. If you are not the intended recipient of this email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the sender that you have received this in error by replying to this message. Then, please delete it from your system. Our Privacy Policy is available here
https://www.msi.com/page/privacy-policy. Thank you.
[10228.102415] usbcore: deregistering interface driver uvcvideo
[10228.166395] usb 1-1: Resuming interface 0
[10228.166399] usb 1-1: Resuming interface 1
[10238.516447] usb 1-1: Probing generic UVC device 1
[10238.516895] usb 1-1: Found format YUV 4:2:2 (YUYV)
[10238.516897] usb 1-1: - 640x360 (30.0 fps)
[10238.516899] usb 1-1: Found format MJPEG
[10238.516900] usb 1-1: - 1920x1080 (30.0 fps)
[10238.516901] usb 1-1: - 1280x720 (30.0 fps)
[10238.516902] usb 1-1: - 3840x1712 (30.0 fps)
[10238.516903] usb 1-1: - 2560x1136 (30.0 fps)
[10238.516904] usb 1-1: - 2560x1440 (30.0 fps)
[10238.516907] usb 1-1: Found a Status endpoint (addr 85)
[10238.516909] usb 1-1: Found UVC 1.00 device Cupola360 Camera (2245:1230)
[10238.516911] usb 1-1: Scanning UVC chain:
[10238.516912] OT 6 <- XU 4 <- XU 3 <- PU 2 <- IT 1
[10238.516915] usb 1-1: Found a valid video chain (1 -> 6)
[10238.516918] usb 1-1: Added control 00000000-0000-0000-0000-000000000101/2 to device 1 entity 2
[10238.519753] usb 1-1: Adding mapping 'Brightness' to control 00000000-0000-0000-0000-000000000101/2
[10238.519756] usb 1-1: Added control 00000000-0000-0000-0000-000000000101/3 to device 1 entity 2
[10238.521738] usb 1-1: Adding mapping 'Contrast' to control 00000000-0000-0000-0000-000000000101/3
[10238.521741] usb 1-1: Added control 00000000-0000-0000-0000-000000000101/7 to device 1 entity 2
[10238.524638] usb 1-1: Adding mapping 'Saturation' to control 00000000-0000-0000-0000-000000000101/7
[10238.524641] usb 1-1: Added control 00000000-0000-0000-0000-000000000101/8 to device 1 entity 2
[10238.528517] usb 1-1: Adding mapping 'Sharpness' to control 00000000-0000-0000-0000-000000000101/8
[10238.528519] usb 1-1: Added control 00000000-0000-0000-0000-000000000101/9 to device 1 entity 2
[10238.533369] usb 1-1: Adding mapping 'Gamma' to control 00000000-0000-0000-0000-000000000101/9
[10238.533373] usb 1-1: Added control 00000000-0000-0000-0000-000000000101/10 to device 1 entity 2
[10238.537354] usb 1-1: Adding mapping 'White Balance Temperature' to control 00000000-0000-0000-0000-000000000101/10
[10238.537358] usb 1-1: Added control 00000000-0000-0000-0000-000000000101/1 to device 1 entity 2
[10238.541310] usb 1-1: Adding mapping 'Backlight Compensation' to control 00000000-0000-0000-0000-000000000101/1
[10238.541313] usb 1-1: Added control 00000000-0000-0000-0000-000000000101/5 to device 1 entity 2
[10238.545304] usb 1-1: Adding mapping 'Power Line Frequency' to control 00000000-0000-0000-0000-000000000101/5
[10238.545307] usb 1-1: Added control 00000000-0000-0000-0000-000000000101/11 to device 1 entity 2
[10238.549130] usb 1-1: Adding mapping 'White Balance, Automatic' to control 00000000-0000-0000-0000-000000000101/11
[10238.549134] usb 1-1: Added control 00000000-0000-0000-0000-000000000001/2 to device 1 entity 1
[10238.553029] usb 1-1: Adding mapping 'Auto Exposure' to control 00000000-0000-0000-0000-000000000001/2
[10238.553033] usb 1-1: Added control 00000000-0000-0000-0000-000000000001/3 to device 1 entity 1
[10238.555980] usb 1-1: Adding mapping 'Exposure, Dynamic Framerate' to control 00000000-0000-0000-0000-000000000001/3
[10238.555983] usb 1-1: Added control 00000000-0000-0000-0000-000000000001/4 to device 1 entity 1
[10238.558990] usb 1-1: Adding mapping 'Exposure Time, Absolute' to control 00000000-0000-0000-0000-000000000001/4
[10238.558993] usb 1-1: Added control 00000000-0000-0000-0000-000000000001/11 to device 1 entity 1
[10238.562800] usb 1-1: Adding mapping 'Zoom, Absolute' to control 00000000-0000-0000-0000-000000000001/11
[10238.562803] usb 1-1: Added control 00000000-0000-0000-0000-000000000001/13 to device 1 entity 1
[10238.565682] usb 1-1: Adding mapping 'Pan, Absolute' to control 00000000-0000-0000-0000-000000000001/13
[10238.565685] usb 1-1: Adding mapping 'Tilt, Absolute' to control 00000000-0000-0000-0000-000000000001/13
[10238.583824] input: Cupola360 Camera as /devices/pci0000:00/0000:00:0b.0/usb1/1-1/1-1:1.0/input/input9
[10238.584441] usb 1-1: uvc_v4l2_open
[10238.584466] usb 1-1: uvc_v4l2_release
[10238.585235] usb 1-1: UVC device initialized
[10238.589916] usbcore: registered new interface driver uvcvideo
[10238.634813] usb 1-1: uvc_v4l2_open
[10238.634908] usb 1-1: uvc_v4l2_release
[10238.641366] usb 1-1: uvc_v4l2_open
[10238.643786] usb 1-1: uvc_v4l2_open
[10238.643790] usb 1-1: uvc_v4l2_release
[10238.643816] usb 1-1: uvc_v4l2_open
[10238.827419] usb 1-1: uvc_v4l2_release
[10238.827463] usb 1-1: uvc_v4l2_release
[10241.066818] usb 1-1: Suspending interface 1
[10241.066822] usb 1-1: Suspending interface 0
[10246.557462] usb 1-1: uvc_v4l2_open
[10246.625260] usb 1-1: Resuming interface 0
[10246.625266] usb 1-1: Resuming interface 1
[10246.645515] usb 1-1: uvc_v4l2_release
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Ricardo,
I need to sincerely apologize to you for my mistake of implanting the wrong GUID, which resulted in the device not being found. This was a foolish error on my part and I am sorry for taking up your valuable time.
Thank you again for your help.
Best Regards,
Hardy
-----Original Message-----
From: hardycheng(鄭易昕)
Sent: Friday, April 28, 2023 5:10 PM
To: Ricardo Ribalda <[email protected]>
Cc: [email protected]
Subject: RE: UVCIOC_CTRL_MAP not work
Hi Ricardo,
Seems like no more message of XU controls, I run my program in time [10246.557462], the relevant message is as follows:
[10246.557462] usb 1-1: uvc_v4l2_open [10246.625260] usb 1-1: Resuming interface 0 [10246.625266] usb 1-1: Resuming interface 1 [10246.645515] usb 1-1: uvc_v4l2_release
Please check attachment of dmseg output dmesg_20230428.log
Best Regards,
Hardy#2374
-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:58 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re: UVCIOC_CTRL_MAP not work
What about:
rmmod uvcvideo
modprobe uvcvideo trace=0xffffffff
then run your program
You might be able to figure out what xu controls are discovered.
Quoted 220 lines · hardycheng(鄭易昕)
Hi Ricardo,
Thank you for such a quick reply.
Follow your advice, but I just got few logs in dmesg[ 9452.677337] usb 1-1: uvc_v4l2_open [ 9452.725254] usb 1-1: Resuming interface 0 [ 9452.725258] usb 1-1:Resuming interface 1 [ 9452.751971] usb 1-1:
uvc_v4l2_release[ 9455.236973] usb 1-1: Suspending interface 1 [ 9455.236977] usb 1-1:
Suspending interface 0Is there any way to get more debug message about this issue?
Best Regards,
Hardy#2374-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:45 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
try running:
echo
0xffffffff>/sys/module/uvcvideo/parameters/traceand then your program
and then dmesg
It will tell you where it got stock
Regards!
Quoted 161 lines · hardycheng(鄭易昕)
Hi Ricardo,
So I modify the
uvc_xu_control_mappingstruct as follows:
(full code reference attachmentuvc_xu_v4l_mapping_demo.c) structuvc_xu_control_mapping mapping = { .id = 0x01, .name = "My Extension Unit", .entity = {0x10, 0xbc, 0x46, 0xba, 0x28, 0x5a, 0x4d, 0x7b, 0x97, 0x0e, 0xfd, 0x91, 0x46, 0xa5, 0x2f, 0x2d}, .selector = 0x01, .size = 32, .offset = 0, .v4l2_type = V4L2_CTRL_TYPE_INTEGER, .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED, .menu_info = NULL, .menu_count = 0, .reserved = {0}, };And I got difference error message
UVCIOC_CTRL_MAP: No such file or directoryPlease check attachmentstrace_20230428_2.logfor strace outputBest Regards,
Hardy-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:26 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
Seems like you can only add mappings for
V4L2_CTRL_TYPE_INTEGER, V4L2_CTRL_TYPE_BOOLEAN:V4L2_CTRL_TYPE_BUTTON andV4L2_CTRL_TYPE_MENU.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/t
re
e/drivers/media/usb/uvc/uvc_v4l2.c#n130You are trying to add a map for a
V4L2_CTRL_TYPE_STRINGRegards
Quoted 96 lines · hardycheng(鄭易昕)
Hi Ricardo,
Thanks for reply,
I replace
_IOWR('u', 0x20, struct uvc_xu_control_mapping)toUVCIOC_CTRL_MAPand got the same error, Please check attachment for command outputstrace -f ./uvc_xu_v4l_mapping_demoBest Regards,
Hardy-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:04 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
Why are you using:
result = ioctl(fd, _IOWR('u',
0x20, structuvc_xu_control_mapping), &mapping);instead of
result =
ioctl(fd, UVCIOC_CTRL_MAP, &mapping);Can you return the output of:
strace -f
uvc_xu_v4l_mapping_demoThanks!
Quoted 41 lines · hardycheng(鄭易昕)
Hi,
# Environment:
OS = Ubuntu 22.04 LTS (Linux version 5.19.0-41-generic) Program Language = C Language
# Overview:
We plug in our UVC camera to PC, and try to use
UVCIOC_CTRL_MAPfunction on PC to create the v4l2 control mapping, but we got errorUVCIOC_CTRL_MAP: Inappropriate ioctl for deviceDevelopment withC languageinUbuntu 22.04 LTS# Description:
We have a custom UVC camera and we can modify the extension unit(XU) by ourself. (USB descriptions reference attachments
uvc_xu_descriptor.PNG&usb_decriptions.txt)We make sure that
UVCIOC_CTRL_QUERYis work to control our XU item (demo code in attachmentuvc_xu_ioctl_demo.c)but
UVCIOC_CTRL_MAPfunction fail with error message `UVCIOC_CTRL_MAP:
Inappropriate ioctl for device(demo code in attachmentuvc_xu_v4l_mapping_demo.c`)# Problems:
1. Is UVCIOC_CTRL_MAP function using in the PC host? 2. Can you found any syntax problem in our demo code `uvc_xu_v4l_mapping_demo.c`? 3. Is there any sample code about struct `uvc_xu_control_mapping` using?Looking forward to your reply,
Best Regards,
Hardy#2374*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity
to whom it is addressed and contains information that may be
subject to and/or may be restricted from disclosure by contract
or applicable law. If you are not the intended recipient of this
email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please
notify the sender that you have received this in error by
replying to this message. Then, please delete it from your
system. Our Privacy Policy is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject
to and/or may be restricted from disclosure by contract or
applicable law. If you are not the intended recipient of this
email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify
the sender that you have received this in error by replying to
this message. Then, please delete it from your system. Our Privacy
Policy is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject to
and/or may be restricted from disclosure by contract or applicable
law. If you are not the intended recipient of this email, be advised
that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify
the sender that you have received this in error by replying to this
message. Then, please delete it from your system. Our Privacy Policy
is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject to
and/or may be restricted from disclosure by contract or applicable
law. If you are not the intended recipient of this email, be advised
that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the
sender that you have received this in error by replying to this
message. Then, please delete it from your system. Our Privacy Policy
is available here https://www.msi.com/page/privacy-policy. Thank you.
--
Ricardo Ribalda
*****CONFIDENTIAL INFORMATION*****
This email is intended only for the use of the person or entity to whom it is addressed and contains information that may be subject to and/or may be restricted from disclosure by contract or applicable law. If you are not the intended recipient of this email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the sender that you have received this in error by replying to this message. Then, please delete it from your system. Our Privacy Policy is available here
https://www.msi.com/page/privacy-policy. Thank you.
Hi Hardy
Quoted 5 lines · hardycheng(鄭易昕)
Hi Ricardo,
I need to sincerely apologize to you for my mistake of implanting the wrong GUID, which resulted in the device not being found. This was a foolish error on my part and I am sorry for taking up your valuable time.
Absolutely no worries, happy that it works for you now :)
Have a great weekend!
Quoted 291 lines
Thank you again for your help.
Best Regards,
Hardy-----Original Message-----
From: hardycheng(鄭易昕)
Sent: Friday, April 28, 2023 5:10 PM
To: Ricardo Ribalda <[email protected]>
Cc: [email protected]
Subject: RE:UVCIOC_CTRL_MAPnot workHi Ricardo,
Seems like no more message of XU controls, I run my program in time [10246.557462], the relevant message is as follows:
[10246.557462] usb 1-1: uvc_v4l2_open [10246.625260] usb 1-1: Resuming interface 0 [10246.625266] usb 1-1: Resuming interface 1 [10246.645515] usb 1-1: uvc_v4l2_releasePlease check attachment of dmseg output
dmesg_20230428.logBest Regards,
Hardy#2374-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:58 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workWhat about:
rmmod uvcvideo
modprobe uvcvideo trace=0xffffffffthen run your program
You might be able to figure out what xu controls are discovered.
Quoted 220 lines · hardycheng(鄭易昕)
Hi Ricardo,
Thank you for such a quick reply.
Follow your advice, but I just got few logs in dmesg[ 9452.677337] usb 1-1: uvc_v4l2_open [ 9452.725254] usb 1-1: Resuming interface 0 [ 9452.725258] usb 1-1:Resuming interface 1 [ 9452.751971] usb 1-1:
uvc_v4l2_release[ 9455.236973] usb 1-1: Suspending interface 1 [ 9455.236977] usb 1-1:
Suspending interface 0Is there any way to get more debug message about this issue?
Best Regards,
Hardy#2374-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:45 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
try running:
echo
0xffffffff>/sys/module/uvcvideo/parameters/traceand then your program
and then dmesg
It will tell you where it got stock
Regards!
Quoted 161 lines · hardycheng(鄭易昕)
Hi Ricardo,
So I modify the
uvc_xu_control_mappingstruct as follows:
(full code reference attachmentuvc_xu_v4l_mapping_demo.c) structuvc_xu_control_mapping mapping = { .id = 0x01, .name = "My Extension Unit", .entity = {0x10, 0xbc, 0x46, 0xba, 0x28, 0x5a, 0x4d, 0x7b, 0x97, 0x0e, 0xfd, 0x91, 0x46, 0xa5, 0x2f, 0x2d}, .selector = 0x01, .size = 32, .offset = 0, .v4l2_type = V4L2_CTRL_TYPE_INTEGER, .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED, .menu_info = NULL, .menu_count = 0, .reserved = {0}, };And I got difference error message
UVCIOC_CTRL_MAP: No such file or directoryPlease check attachmentstrace_20230428_2.logfor strace outputBest Regards,
Hardy-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:26 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
Seems like you can only add mappings for
V4L2_CTRL_TYPE_INTEGER, V4L2_CTRL_TYPE_BOOLEAN:V4L2_CTRL_TYPE_BUTTON andV4L2_CTRL_TYPE_MENU.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/t
re
e/drivers/media/usb/uvc/uvc_v4l2.c#n130You are trying to add a map for a
V4L2_CTRL_TYPE_STRINGRegards
Quoted 96 lines · hardycheng(鄭易昕)
Hi Ricardo,
Thanks for reply,
I replace
_IOWR('u', 0x20, struct uvc_xu_control_mapping)toUVCIOC_CTRL_MAPand got the same error, Please check attachment for command outputstrace -f ./uvc_xu_v4l_mapping_demoBest Regards,
Hardy-----Original Message-----
From: Ricardo Ribalda <[email protected]>
Sent: Friday, April 28, 2023 4:04 PM
To: hardycheng(鄭易昕) <[email protected]>
Cc: [email protected]
Subject: Re:UVCIOC_CTRL_MAPnot workHi Hardy
Why are you using:
result = ioctl(fd, _IOWR('u',
0x20, structuvc_xu_control_mapping), &mapping);instead of
result =
ioctl(fd, UVCIOC_CTRL_MAP, &mapping);Can you return the output of:
strace -f
uvc_xu_v4l_mapping_demoThanks!
Quoted 41 lines · hardycheng(鄭易昕)
Hi,
# Environment:
OS = Ubuntu 22.04 LTS (Linux version 5.19.0-41-generic) Program Language = C Language
# Overview:
We plug in our UVC camera to PC, and try to use
UVCIOC_CTRL_MAPfunction on PC to create the v4l2 control mapping, but we got errorUVCIOC_CTRL_MAP: Inappropriate ioctl for deviceDevelopment withC languageinUbuntu 22.04 LTS# Description:
We have a custom UVC camera and we can modify the extension unit(XU) by ourself. (USB descriptions reference attachments
uvc_xu_descriptor.PNG&usb_decriptions.txt)We make sure that
UVCIOC_CTRL_QUERYis work to control our XU item (demo code in attachmentuvc_xu_ioctl_demo.c)but
UVCIOC_CTRL_MAPfunction fail with error message `UVCIOC_CTRL_MAP:
Inappropriate ioctl for device(demo code in attachmentuvc_xu_v4l_mapping_demo.c`)# Problems:
1. Is UVCIOC_CTRL_MAP function using in the PC host? 2. Can you found any syntax problem in our demo code `uvc_xu_v4l_mapping_demo.c`? 3. Is there any sample code about struct `uvc_xu_control_mapping` using?Looking forward to your reply,
Best Regards,
Hardy#2374*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity
to whom it is addressed and contains information that may be
subject to and/or may be restricted from disclosure by contract
or applicable law. If you are not the intended recipient of this
email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please
notify the sender that you have received this in error by
replying to this message. Then, please delete it from your
system. Our Privacy Policy is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject
to and/or may be restricted from disclosure by contract or
applicable law. If you are not the intended recipient of this
email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify
the sender that you have received this in error by replying to
this message. Then, please delete it from your system. Our Privacy
Policy is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject to
and/or may be restricted from disclosure by contract or applicable
law. If you are not the intended recipient of this email, be advised
that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify
the sender that you have received this in error by replying to this
message. Then, please delete it from your system. Our Privacy Policy
is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
Quoted 9 lines
This email is intended only for the use of the person or entity to
whom it is addressed and contains information that may be subject to
and/or may be restricted from disclosure by contract or applicable
law. If you are not the intended recipient of this email, be advised
that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the
sender that you have received this in error by replying to this
message. Then, please delete it from your system. Our Privacy Policy
is available here https://www.msi.com/page/privacy-policy. Thank you.--
Ricardo Ribalda*****CONFIDENTIAL INFORMATION*****
This email is intended only for the use of the person or entity to whom it is addressed and contains information that may be subject to and/or may be restricted from disclosure by contract or applicable law. If you are not the intended recipient of this email, be advised that any disclosure, copy, distribution or use of the contents of this message is strictly prohibited. If you are not the intended recipient of this email, please notify the sender that you have received this in error by replying to this message. Then, please delete it from your system. Our Privacy Policy is available here
https://www.msi.com/page/privacy-policy. Thank you.
Signature · 1 line
Ricardo Ribalda