18c2ecf20Sopenharmony_ci========================================= 28c2ecf20Sopenharmony_ciKernel CAPI Interface to Hardware Drivers 38c2ecf20Sopenharmony_ci========================================= 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci1. Overview 68c2ecf20Sopenharmony_ci=========== 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ciFrom the CAPI 2.0 specification: 98c2ecf20Sopenharmony_ciCOMMON-ISDN-API (CAPI) is an application programming interface standard used 108c2ecf20Sopenharmony_cito access ISDN equipment connected to basic rate interfaces (BRI) and primary 118c2ecf20Sopenharmony_cirate interfaces (PRI). 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciKernel CAPI operates as a dispatching layer between CAPI applications and CAPI 148c2ecf20Sopenharmony_cihardware drivers. Hardware drivers register ISDN devices (controllers, in CAPI 158c2ecf20Sopenharmony_cilingo) with Kernel CAPI to indicate their readiness to provide their service 168c2ecf20Sopenharmony_cito CAPI applications. CAPI applications also register with Kernel CAPI, 178c2ecf20Sopenharmony_cirequesting association with a CAPI device. Kernel CAPI then dispatches the 188c2ecf20Sopenharmony_ciapplication registration to an available device, forwarding it to the 198c2ecf20Sopenharmony_cicorresponding hardware driver. Kernel CAPI then forwards CAPI messages in both 208c2ecf20Sopenharmony_cidirections between the application and the hardware driver. 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciFormat and semantics of CAPI messages are specified in the CAPI 2.0 standard. 238c2ecf20Sopenharmony_ciThis standard is freely available from https://www.capi.org. 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci2. Driver and Device Registration 278c2ecf20Sopenharmony_ci================================= 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ciCAPI drivers must register each of the ISDN devices they control with Kernel 308c2ecf20Sopenharmony_ciCAPI by calling the Kernel CAPI function attach_capi_ctr() with a pointer to a 318c2ecf20Sopenharmony_cistruct capi_ctr before they can be used. This structure must be filled with 328c2ecf20Sopenharmony_cithe names of the driver and controller, and a number of callback function 338c2ecf20Sopenharmony_cipointers which are subsequently used by Kernel CAPI for communicating with the 348c2ecf20Sopenharmony_cidriver. The registration can be revoked by calling the function 358c2ecf20Sopenharmony_cidetach_capi_ctr() with a pointer to the same struct capi_ctr. 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ciBefore the device can be actually used, the driver must fill in the device 388c2ecf20Sopenharmony_ciinformation fields 'manu', 'version', 'profile' and 'serial' in the capi_ctr 398c2ecf20Sopenharmony_cistructure of the device, and signal its readiness by calling capi_ctr_ready(). 408c2ecf20Sopenharmony_ciFrom then on, Kernel CAPI may call the registered callback functions for the 418c2ecf20Sopenharmony_cidevice. 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ciIf the device becomes unusable for any reason (shutdown, disconnect ...), the 448c2ecf20Sopenharmony_cidriver has to call capi_ctr_down(). This will prevent further calls to the 458c2ecf20Sopenharmony_cicallback functions by Kernel CAPI. 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci3. Application Registration and Communication 498c2ecf20Sopenharmony_ci============================================= 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ciKernel CAPI forwards registration requests from applications (calls to CAPI 528c2ecf20Sopenharmony_cioperation CAPI_REGISTER) to an appropriate hardware driver by calling its 538c2ecf20Sopenharmony_ciregister_appl() callback function. A unique Application ID (ApplID, u16) is 548c2ecf20Sopenharmony_ciallocated by Kernel CAPI and passed to register_appl() along with the 558c2ecf20Sopenharmony_ciparameter structure provided by the application. This is analogous to the 568c2ecf20Sopenharmony_ciopen() operation on regular files or character devices. 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ciAfter a successful return from register_appl(), CAPI messages from the 598c2ecf20Sopenharmony_ciapplication may be passed to the driver for the device via calls to the 608c2ecf20Sopenharmony_cisend_message() callback function. Conversely, the driver may call Kernel 618c2ecf20Sopenharmony_ciCAPI's capi_ctr_handle_message() function to pass a received CAPI message to 628c2ecf20Sopenharmony_ciKernel CAPI for forwarding to an application, specifying its ApplID. 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ciDeregistration requests (CAPI operation CAPI_RELEASE) from applications are 658c2ecf20Sopenharmony_ciforwarded as calls to the release_appl() callback function, passing the same 668c2ecf20Sopenharmony_ciApplID as with register_appl(). After return from release_appl(), no CAPI 678c2ecf20Sopenharmony_cimessages for that application may be passed to or from the device anymore. 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci4. Data Structures 718c2ecf20Sopenharmony_ci================== 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci4.1 struct capi_driver 748c2ecf20Sopenharmony_ci---------------------- 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ciThis structure describes a Kernel CAPI driver itself. It is used in the 778c2ecf20Sopenharmony_ciregister_capi_driver() and unregister_capi_driver() functions, and contains 788c2ecf20Sopenharmony_cithe following non-private fields, all to be set by the driver before calling 798c2ecf20Sopenharmony_ciregister_capi_driver(): 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci``char name[32]`` 828c2ecf20Sopenharmony_ci the name of the driver, as a zero-terminated ASCII string 838c2ecf20Sopenharmony_ci``char revision[32]`` 848c2ecf20Sopenharmony_ci the revision number of the driver, as a zero-terminated ASCII string 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci4.2 struct capi_ctr 878c2ecf20Sopenharmony_ci------------------- 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ciThis structure describes an ISDN device (controller) handled by a Kernel CAPI 908c2ecf20Sopenharmony_cidriver. After registration via the attach_capi_ctr() function it is passed to 918c2ecf20Sopenharmony_ciall controller specific lower layer interface and callback functions to 928c2ecf20Sopenharmony_ciidentify the controller to operate on. 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ciIt contains the following non-private fields: 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_cito be set by the driver before calling attach_capi_ctr(): 978c2ecf20Sopenharmony_ci^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci``struct module *owner`` 1008c2ecf20Sopenharmony_ci pointer to the driver module owning the device 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci``void *driverdata`` 1038c2ecf20Sopenharmony_ci an opaque pointer to driver specific data, not touched by Kernel CAPI 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci``char name[32]`` 1068c2ecf20Sopenharmony_ci the name of the controller, as a zero-terminated ASCII string 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci``char *driver_name`` 1098c2ecf20Sopenharmony_ci the name of the driver, as a zero-terminated ASCII string 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci``int (*load_firmware)(struct capi_ctr *ctrlr, capiloaddata *ldata)`` 1128c2ecf20Sopenharmony_ci (optional) pointer to a callback function for sending firmware and 1138c2ecf20Sopenharmony_ci configuration data to the device 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci The function may return before the operation has completed. 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci Completion must be signalled by a call to capi_ctr_ready(). 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci Return value: 0 on success, error code on error 1208c2ecf20Sopenharmony_ci Called in process context. 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci``void (*reset_ctr)(struct capi_ctr *ctrlr)`` 1238c2ecf20Sopenharmony_ci (optional) pointer to a callback function for stopping the device, 1248c2ecf20Sopenharmony_ci releasing all registered applications 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci The function may return before the operation has completed. 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci Completion must be signalled by a call to capi_ctr_down(). 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci Called in process context. 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci``void (*register_appl)(struct capi_ctr *ctrlr, u16 applid, capi_register_params *rparam)`` 1338c2ecf20Sopenharmony_ci pointers to callback function for registration of 1348c2ecf20Sopenharmony_ci applications with the device 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci Calls to these functions are serialized by Kernel CAPI so that only 1378c2ecf20Sopenharmony_ci one call to any of them is active at any time. 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci``void (*release_appl)(struct capi_ctr *ctrlr, u16 applid)`` 1408c2ecf20Sopenharmony_ci pointers to callback functions deregistration of 1418c2ecf20Sopenharmony_ci applications with the device 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci Calls to these functions are serialized by Kernel CAPI so that only 1448c2ecf20Sopenharmony_ci one call to any of them is active at any time. 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci``u16 (*send_message)(struct capi_ctr *ctrlr, struct sk_buff *skb)`` 1478c2ecf20Sopenharmony_ci pointer to a callback function for sending a CAPI message to the 1488c2ecf20Sopenharmony_ci device 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci Return value: CAPI error code 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci If the method returns 0 (CAPI_NOERROR) the driver has taken ownership 1538c2ecf20Sopenharmony_ci of the skb and the caller may no longer access it. If it returns a 1548c2ecf20Sopenharmony_ci non-zero (error) value then ownership of the skb returns to the caller 1558c2ecf20Sopenharmony_ci who may reuse or free it. 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci The return value should only be used to signal problems with respect 1588c2ecf20Sopenharmony_ci to accepting or queueing the message. Errors occurring during the 1598c2ecf20Sopenharmony_ci actual processing of the message should be signaled with an 1608c2ecf20Sopenharmony_ci appropriate reply message. 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci May be called in process or interrupt context. 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ci Calls to this function are not serialized by Kernel CAPI, ie. it must 1658c2ecf20Sopenharmony_ci be prepared to be re-entered. 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci``char *(*procinfo)(struct capi_ctr *ctrlr)`` 1688c2ecf20Sopenharmony_ci pointer to a callback function returning the entry for the device in 1698c2ecf20Sopenharmony_ci the CAPI controller info table, /proc/capi/controller 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ciNote: 1728c2ecf20Sopenharmony_ci Callback functions except send_message() are never called in interrupt 1738c2ecf20Sopenharmony_ci context. 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_cito be filled in before calling capi_ctr_ready(): 1768c2ecf20Sopenharmony_ci^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ci``u8 manu[CAPI_MANUFACTURER_LEN]`` 1798c2ecf20Sopenharmony_ci value to return for CAPI_GET_MANUFACTURER 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci``capi_version version`` 1828c2ecf20Sopenharmony_ci value to return for CAPI_GET_VERSION 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci``capi_profile profile`` 1858c2ecf20Sopenharmony_ci value to return for CAPI_GET_PROFILE 1868c2ecf20Sopenharmony_ci 1878c2ecf20Sopenharmony_ci``u8 serial[CAPI_SERIAL_LEN]`` 1888c2ecf20Sopenharmony_ci value to return for CAPI_GET_SERIAL 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_ci4.3 SKBs 1928c2ecf20Sopenharmony_ci-------- 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_ciCAPI messages are passed between Kernel CAPI and the driver via send_message() 1958c2ecf20Sopenharmony_ciand capi_ctr_handle_message(), stored in the data portion of a socket buffer 1968c2ecf20Sopenharmony_ci(skb). Each skb contains a single CAPI message coded according to the CAPI 2.0 1978c2ecf20Sopenharmony_cistandard. 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ciFor the data transfer messages, DATA_B3_REQ and DATA_B3_IND, the actual 2008c2ecf20Sopenharmony_cipayload data immediately follows the CAPI message itself within the same skb. 2018c2ecf20Sopenharmony_ciThe Data and Data64 parameters are not used for processing. The Data64 2028c2ecf20Sopenharmony_ciparameter may be omitted by setting the length field of the CAPI message to 22 2038c2ecf20Sopenharmony_ciinstead of 30. 2048c2ecf20Sopenharmony_ci 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_ci4.4 The _cmsg Structure 2078c2ecf20Sopenharmony_ci----------------------- 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci(declared in <linux/isdn/capiutil.h>) 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ciThe _cmsg structure stores the contents of a CAPI 2.0 message in an easily 2128c2ecf20Sopenharmony_ciaccessible form. It contains members for all possible CAPI 2.0 parameters, 2138c2ecf20Sopenharmony_ciincluding subparameters of the Additional Info and B Protocol structured 2148c2ecf20Sopenharmony_ciparameters, with the following exceptions: 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_ci* second Calling party number (CONNECT_IND) 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci* Data64 (DATA_B3_REQ and DATA_B3_IND) 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci* Sending complete (subparameter of Additional Info, CONNECT_REQ and INFO_REQ) 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci* Global Configuration (subparameter of B Protocol, CONNECT_REQ, CONNECT_RESP 2238c2ecf20Sopenharmony_ci and SELECT_B_PROTOCOL_REQ) 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_ciOnly those parameters appearing in the message type currently being processed 2268c2ecf20Sopenharmony_ciare actually used. Unused members should be set to zero. 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ciMembers are named after the CAPI 2.0 standard names of the parameters they 2298c2ecf20Sopenharmony_cirepresent. See <linux/isdn/capiutil.h> for the exact spelling. Member data 2308c2ecf20Sopenharmony_citypes are: 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_ci=========== ================================================================= 2338c2ecf20Sopenharmony_ciu8 for CAPI parameters of type 'byte' 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ciu16 for CAPI parameters of type 'word' 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_ciu32 for CAPI parameters of type 'dword' 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci_cstruct for CAPI parameters of type 'struct' 2408c2ecf20Sopenharmony_ci The member is a pointer to a buffer containing the parameter in 2418c2ecf20Sopenharmony_ci CAPI encoding (length + content). It may also be NULL, which will 2428c2ecf20Sopenharmony_ci be taken to represent an empty (zero length) parameter. 2438c2ecf20Sopenharmony_ci Subparameters are stored in encoded form within the content part. 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci_cmstruct alternative representation for CAPI parameters of type 'struct' 2468c2ecf20Sopenharmony_ci (used only for the 'Additional Info' and 'B Protocol' parameters) 2478c2ecf20Sopenharmony_ci The representation is a single byte containing one of the values: 2488c2ecf20Sopenharmony_ci CAPI_DEFAULT: The parameter is empty/absent. 2498c2ecf20Sopenharmony_ci CAPI_COMPOSE: The parameter is present. 2508c2ecf20Sopenharmony_ci Subparameter values are stored individually in the corresponding 2518c2ecf20Sopenharmony_ci _cmsg structure members. 2528c2ecf20Sopenharmony_ci=========== ================================================================= 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_ci5. Lower Layer Interface Functions 2568c2ecf20Sopenharmony_ci================================== 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_ci:: 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_ci int attach_capi_ctr(struct capi_ctr *ctrlr) 2618c2ecf20Sopenharmony_ci int detach_capi_ctr(struct capi_ctr *ctrlr) 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_ciregister/unregister a device (controller) with Kernel CAPI 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_ci:: 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci void capi_ctr_ready(struct capi_ctr *ctrlr) 2688c2ecf20Sopenharmony_ci void capi_ctr_down(struct capi_ctr *ctrlr) 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_cisignal controller ready/not ready 2718c2ecf20Sopenharmony_ci 2728c2ecf20Sopenharmony_ci:: 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ci void capi_ctr_handle_message(struct capi_ctr * ctrlr, u16 applid, 2758c2ecf20Sopenharmony_ci struct sk_buff *skb) 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_cipass a received CAPI message to Kernel CAPI 2788c2ecf20Sopenharmony_cifor forwarding to the specified application 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_ci6. Helper Functions and Macros 2828c2ecf20Sopenharmony_ci============================== 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ciMacros to extract/set element values from/in a CAPI message header 2858c2ecf20Sopenharmony_ci(from <linux/isdn/capiutil.h>): 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_ci====================== ============================= ==================== 2888c2ecf20Sopenharmony_ciGet Macro Set Macro Element (Type) 2898c2ecf20Sopenharmony_ci====================== ============================= ==================== 2908c2ecf20Sopenharmony_ciCAPIMSG_LEN(m) CAPIMSG_SETLEN(m, len) Total Length (u16) 2918c2ecf20Sopenharmony_ciCAPIMSG_APPID(m) CAPIMSG_SETAPPID(m, applid) ApplID (u16) 2928c2ecf20Sopenharmony_ciCAPIMSG_COMMAND(m) CAPIMSG_SETCOMMAND(m,cmd) Command (u8) 2938c2ecf20Sopenharmony_ciCAPIMSG_SUBCOMMAND(m) CAPIMSG_SETSUBCOMMAND(m, cmd) Subcommand (u8) 2948c2ecf20Sopenharmony_ciCAPIMSG_CMD(m) - Command*256 2958c2ecf20Sopenharmony_ci + Subcommand (u16) 2968c2ecf20Sopenharmony_ciCAPIMSG_MSGID(m) CAPIMSG_SETMSGID(m, msgid) Message Number (u16) 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ciCAPIMSG_CONTROL(m) CAPIMSG_SETCONTROL(m, contr) Controller/PLCI/NCCI 2998c2ecf20Sopenharmony_ci (u32) 3008c2ecf20Sopenharmony_ciCAPIMSG_DATALEN(m) CAPIMSG_SETDATALEN(m, len) Data Length (u16) 3018c2ecf20Sopenharmony_ci====================== ============================= ==================== 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_ciLibrary functions for working with _cmsg structures 3058c2ecf20Sopenharmony_ci(from <linux/isdn/capiutil.h>): 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci``char *capi_cmd2str(u8 Command, u8 Subcommand)`` 3088c2ecf20Sopenharmony_ci Returns the CAPI 2.0 message name corresponding to the given command 3098c2ecf20Sopenharmony_ci and subcommand values, as a static ASCII string. The return value may 3108c2ecf20Sopenharmony_ci be NULL if the command/subcommand is not one of those defined in the 3118c2ecf20Sopenharmony_ci CAPI 2.0 standard. 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_ci7. Debugging 3158c2ecf20Sopenharmony_ci============ 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ciThe module kernelcapi has a module parameter showcapimsgs controlling some 3188c2ecf20Sopenharmony_cidebugging output produced by the module. It can only be set when the module is 3198c2ecf20Sopenharmony_ciloaded, via a parameter "showcapimsgs=<n>" to the modprobe command, either on 3208c2ecf20Sopenharmony_cithe command line or in the configuration file. 3218c2ecf20Sopenharmony_ci 3228c2ecf20Sopenharmony_ciIf the lowest bit of showcapimsgs is set, kernelcapi logs controller and 3238c2ecf20Sopenharmony_ciapplication up and down events. 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ciIn addition, every registered CAPI controller has an associated traceflag 3268c2ecf20Sopenharmony_ciparameter controlling how CAPI messages sent from and to tha controller are 3278c2ecf20Sopenharmony_cilogged. The traceflag parameter is initialized with the value of the 3288c2ecf20Sopenharmony_cishowcapimsgs parameter when the controller is registered, but can later be 3298c2ecf20Sopenharmony_cichanged via the MANUFACTURER_REQ command KCAPI_CMD_TRACE. 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_ciIf the value of traceflag is non-zero, CAPI messages are logged. 3328c2ecf20Sopenharmony_ciDATA_B3 messages are only logged if the value of traceflag is > 2. 3338c2ecf20Sopenharmony_ci 3348c2ecf20Sopenharmony_ciIf the lowest bit of traceflag is set, only the command/subcommand and message 3358c2ecf20Sopenharmony_cilength are logged. Otherwise, kernelcapi logs a readable representation of 3368c2ecf20Sopenharmony_cithe entire message. 337