Sponsored Content
Full Discussion: If else condition
Top Forums UNIX for Dummies Questions & Answers If else condition Post 302952488 by vbe on Wednesday 19th of August 2015 10:40:04 AM
Old 08-19-2015
This said, we are off topic considering the thread's title and so I will close the thread.
Up the the user to open a new threadregarding his new request...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

if condition ...

i have following if condition if above statement is case sensitive.....what is syntax if i have to make above comparision case insensetive (4 Replies)
Discussion started by: mahabunta
4 Replies

2. Shell Programming and Scripting

if condition

Hi friends, :) In a shell script i found the following if condition. echo -n "Which version of $1 do you want to restore ('0' to quit)? : " read desired if ${desired:=1} -ge $index ] ; then echo "$0: Restore canceled by user: index value too big." >&2 exit 1 fi Can... (1 Reply)
Discussion started by: ravi raj kumar
1 Replies

3. Shell Programming and Scripting

if..else condition

i have a paramter data_date in which i am passing a string value.i want to find out another paramter file_date from this.the logic is given below if day of data_date = sunday or monday then file_date=data_date-1 else file_date=data_date-2 i am passing data_date as 20061027. how can i... (3 Replies)
Discussion started by: dr46014
3 Replies

4. Shell Programming and Scripting

If Condition

Hi, I am trying to execute this command, but is it not working, says "`;' unexpected" eval $lgrep $SAM_CMD ; if ; then ; echo "No Error" ; fi What i want is, return the command output, if it is non zero, say "No Error". Thanks, John. (21 Replies)
Discussion started by: john_prince
21 Replies

5. HP-UX

Difference between [condition] and [[condition]] and ((condition)) when used with if condition

Executed the following if conditions .. and got different results . only (( )) gave correct o/p with all scenarios . Can anybody please let me know what is the difference between and ] and ((condition)) when used with if condition. And why each condition gave different result. 1.... (2 Replies)
Discussion started by: soumyabubun
2 Replies

6. Shell Programming and Scripting

redirect stdout echo command in condition A run in condition B

hi, I have some problems in my simple script about the redirect echo stdout command inside a condition. Why is the echo command inside the elif still execute in the else command Here are my simple script After check on the two diff output the echo stdout redirect is present in two diff... (3 Replies)
Discussion started by: jao_madn
3 Replies

7. Shell Programming and Scripting

if condition

if chr1:109457160 1 109457160 99.1735537190083 + chr1:109457233 1 109457233 99.1735537190083 - chr1:109457614 1 109457614 99.1735537190083 + chr1:109457618 1 109457618 100 + chr1:109457943 1 109457943 100 - chr1:109458224 1 109458224 99.1735537190083 - file1.txt If 6th column in... (3 Replies)
Discussion started by: johnkim0806
3 Replies

8. Shell Programming and Scripting

If condition return 0 even when it fails to satisfy te condition

HI My doubt may be basic one but I need to get it clarified.. When i use "if" condition that checks for many AND, OR logical conditions like if ]; then return 0 fi Even the if condition fails it returns as zero.. Any clue.. But if i add else condition like if ]; ... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

9. UNIX for Dummies Questions & Answers

IF [ condition ] help

Hi all Unix newbie - please be gentle Am modifying an existing script to error trap a variable with a length of 0 #!/bin/bash ipfile='/var/data/bin/ipaddress' ] && ipold="$(< "$ipfile" )" ipnew="$( wget -q -O - checkip.dyndns.org | sed -e 's/.*Current IP Address: //;s/<.*$//' )" #... (6 Replies)
Discussion started by: CRChamberlain
6 Replies

10. Shell Programming and Scripting

Help with if condition

o/p of my command is given below My requirement is if Pnumber is 0 then stabilization.Build.2013 else stabilization.PBuild.2013.3 (11 Replies)
Discussion started by: nikhil jain
11 Replies
IIC(9)							   BSD Kernel Developer's Manual						    IIC(9)

NAME
iic_acquire_bus, iic_release_bus, iic_exec, iic_smbus_write_byte, iic_smbus_read_byte, iic_smbus_receive_byte -- Inter IC (I2C) bus SYNOPSIS
#include <dev/i2c/i2cvar.h> int iic_acquire_bus(i2c_tag_t ic, int flags); int iic_release_bus(i2c_tag_t ic, int flags); int iic_exec(i2c_tag_t ic, i2c_op_t op, i2c_addr_t addr, const void *cmdbuf, size_t cmdlen, void *buf, size_t buflen, int flags); int iic_smbus_write_byte(i2c_tag_t ic, i2c_addr_t addr, uint8_t cmd, uint8_t data, int flags); int iic_smbus_read_byte(i2c_tag_t ic, i2c_addr_t addr, uint8_t cmd, uint8_t *datap, int flags); int iic_smbus_receive_byte(i2c_tag_t ic, i2c_addr_t addr, uint8_t *datap, int flags); DESCRIPTION
I2C is a two-wire bus developed by Philips used for connecting integrated circuits. It is commonly used for connecting devices such as EEP- ROMs, temperature sensors, fan controllers, real-time clocks, tuners, and other types of integrated circuits. The iic interface provides a means of communicating with I2C-connected devices. The System Management Bus, or SMBus, is a variant of the I2C bus with a simplified com- mand protocol and some electrical differences. DATA TYPES
Drivers for devices attached to the I2C bus will make use of the following data types: i2c_tag_t Controller tag for the I2C bus. This is a pointer to a struct i2c_controller, consisting of function pointers filled in by the I2C controller driver. i2c_op_t I2C bus operation. The following I2C bus operations are defined: I2C_OP_READ Perform a read operation. I2C_OP_READ_WITH_STOP Perform a read operation and send a STOP condition on the I2C bus at the conclusion of the read. I2C_OP_WRITE Perform a write operation. I2C_OP_WRITE_WITH_STOP Perform a write operation and send a STOP condition on the I2C bus at the conclusion of the write. i2c_addr_t I2C device address. struct i2c_attach_args Devices are attached to an I2C bus using this structure. The structure is defined as follows: struct i2c_attach_args { i2c_tag_t ia_tag; /* controller */ i2c_addr_t ia_addr; /* address of device */ int ia_size; /* size (for EEPROMs) */ }; FUNCTIONS
The following functions comprise the API provided to drivers of I2C-connected devices: iic_acquire_bus(ic, flags) Acquire an exclusive lock on the I2C bus. This is required since only one device may communicate on the I2C bus at a time. Driv- ers should acquire the bus lock, perform the I2C bus operations necessary, and then release the bus lock. Passing the I2C_F_POLL flag indicates to iic_acquire_bus() that sleeping is not permitted. iic_release_bus(ic, flags) Release an exclusive lock on the I2C bus. If the I2C_F_POLL flag was passed to iic_acquire_bus(), it must also be passed to iic_release_bus(). iic_exec(ic, op, addr, cmdbuf, cmdlen, buf, buflen, flags) Perform a series of I2C transactions on the bus. iic_exec() initiates the operation by sending a START condition on the I2C bus and then transmitting the address of the target device along with the transaction type. If cmdlen is non-zero, the command pointed to by cmdbuf is then sent to the device. If buflen is non-zero, iic_exec() will then transmit or receive the data, as indicated by op. If op indicates a read operation, iic_exec() will send a REPEATED START before transferring the data. If op so indicates, a STOP condition will be sent on the I2C bus at the conclusion of the operation. Passing the I2C_F_POLL flag indicates to iic_exec() that sleeping is not permitted. iic_smbus_write_byte(ic, addr, cmd, data, flags) Perform an SMBus WRITE BYTE operation. This is equivalent to I2C_OP_WRITE_WITH_STOP with cmdlen of 1 and buflen of 1. iic_smbus_read_byte(ic, addr, cmd, datap, flags) Perform an SMBus READ BYTE operation. This is equivalent to I2C_OP_READ_WITH_STOP with cmdlen of 1 and buflen of 1. iic_smbus_receive_byte(ic, addr, datap, flags) Perform an SMBus RECEIVE BYTE operation. This is equivalent to I2C_OP_READ_WITH_STOP with cmdlen of 0 and buflen of 1. CONTROLLER INTERFACE
The I2C controller driver must fill in the function pointers of an i2c_controller structure, which is defined as follows: struct i2c_controller { void *ic_cookie; /* controller private */ int (*ic_acquire_bus)(void *, int); void (*ic_release_bus)(void *, int); int (*ic_exec)(void *, i2c_op_t, i2c_addr_t, const void *, size_t, void *, size_t, int); int (*ic_send_start)(void *, int); int (*ic_send_stop)(void *, int); int (*ic_initiate_xfer)(void *, i2c_addr_t, int); int (*ic_read_byte)(void *, uint8_t *, int); int (*ic_write_byte)(void *, uint8_t, int); }; The (*ic_acquire_bus)() and (*ic_release_bus)() functions must always be provided. The controller driver may elect to provide an (*ic_exec)() function. This function is intended for use by automated controllers that do not provide manual control over I2C bus conditions such as START and STOP. If the (*ic_exec)() function is not provided, the following 5 functions will be used by iic_exec() in order to execute the I2C bus operation: (*ic_send_start)(cookie, flags) Send a START condition on the I2C bus. The I2C_F_POLL flag indicates that sleeping is not permitted. (*ic_send_stop)(cookie, flags) Send a STOP condition on the I2C bus. The I2C_F_POLL flag indicates that sleeping is not permitted. (*ic_initiate_xfer)(cookie, addr, flags) Initiate a transfer on the I2C bus by sending a START condition and then transmitting the I2C device address and transfer type. The I2C_F_READ flag indicates a read transfer; the lack of this flag indicates a write transfer. The I2C_F_POLL flag indicates that sleep- ing is not permitted. The error code ETIMEDOUT should be returned if a timeout that would indicate that the device is not present occurs. (*ic_read_byte)(cookie, datap, flags) Read a byte from the I2C bus into the memory location referenced by datap. The I2C_F_LAST flag indicates that this is the final byte of the transfer, and that a NACK condition should be sent on the I2C bus following the transfer of the byte. The I2C_F_STOP flag indi- cates that a STOP condition should be sent on the I2C bus following the transfer of the byte. The I2C_F_POLL flag indicates that sleeping is not permitted. (*ic_write_byte)(cookie, data, flags) Write the byte contained in data to the I2C bus. The I2C_F_STOP flag indicates that a STOP condition should be sent on the I2C bus following the transfer of the byte. The I2C_F_POLL flag indicates that sleeping is not permitted. SEE ALSO
iic(4), i2cscan(8) NXP Semiconductors, I2C-bus Specification and User Manual, Revision 03, http://www.ics.nxp.com/support/documents/i2c/pdf/i2c.bus.specification.pdf, June 19, 2007. Duracell Inc. et. al., System Management Bus (SMBus) Specification, Version 2.0, http://smbus.org/specs/smbus20.pdf, August 3, 2000. HISTORY
The iic API first appeared in NetBSD 2.0. OpenBSD support was added in OpenBSD 3.6. AUTHORS
The iic API was written by Steve C. Woodford and Jason R. Thorpe for NetBSD and then ported to OpenBSD by Alexander Yurchenko <grange@openbsd.org>. BSD
October 15, 2011 BSD
All times are GMT -4. The time now is 07:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy