Tuesday, July 14, 2015

Updating Samsung Tab 10.1 to Lollipop (GT-P7500)

If you are like me you probably have an older Samsung 10.1 Tablet sitting around somewhere in your house.

I got mine back in 2012 when all of the mobile carriers pushed out these tablets with a 2 year plan. I cancelled my plan within a few months and it still worked out to be cheaper then purchasing a brand new tablet.

Taking it home you probably noticed that Samsung hadn't really kept the device up to date with the newest versions of Android OS even the stock OS was out of date at the time. You most likely got sick of the stock OS after a few days and started looking for a way to update your tablet unofficially.

You probably came across a cool project called Cyanogenmod on your hunt, which did a good job keeping the tablet updated. You found this was acceptable as it was the newest version of Android OS at the time. But with the release of Lollipop over a year later. You are looking to see if Cyanogenmod has updated, you check to find that there is nothing but even worse realizing that they have stopped supporting at all officially. You lost your hopes and you stopped searching..

One day, you see it laying around and you decided to search to see if anyone has updated this device, Then you came across my blog. Well you are in luck!

According to the user detcaf on XDA Forums. AOSP has an unofficial custom ROM for the Samsing 10.1 tablet (p4). However before beginning you should note that I do not take any responsibility for anything that happens to your tablet from following this post. You take full responsibility and should understand the risks for anything that you do to your tablet.

Before starting make sure your tablet is fully charged!

1. Install Clockwork Mod or Team Win's Recovery Project if you have not already. (See Post)
2. Download aosp-5.1.1-p4-20150628.zip which contains the custom ROM.
3. Download p75xx-gapps-L-5-6-15.zip
4. Download SuperSU
5. Move downloaded zips to the root folder on the tablet.
6. Restart the tablet, boot into CWM or TWRP.
7. Install from .zip in the order downloaded
8. Reboot will take longer than normal (80 applications to be installed after initial setup)

Enjoy!






Install CWM or TWRP

ClockworkMod (shortened to CWM) and Team Win’s Recovery Project (commonly referred to as TWRP) are the two most popular solutions, and while the two differ slightly, they both have the essential features you need.

Pre-requisites:
  • USB drivers for your phone must be installed on a computer. You can grab them from the official website of the company that made the phone. Get the latest:
Samsung Android USB drivers here
HTC Android USB drivers (included in HTC Sync) here
LG Android USB drivers here (go to “Software updates” > Select your phone > Click on “Install USB Drivers”)
Sony Android USB drivers here
Motorola Android USB drivers (included in Motorola Device Manager) here


  • Download the latest version of either CWM or TWRP (we prefer CWM, but both work equally well). For CWM go to this website, find your device, and download the image for it:
Download CWM here
For TWRP go to this website, click on “Get TWRP for your device” and type you device's name to download the image for it:

  • Your phone must be connected to your computer via USB. If you get stuck at some point in the tutorial, a common fix is to try disconnecting the phone and re-connecting it again.
1. Allow USB Debugging on your device.
2. Terminal
To open the terminal in Windows 7, hit the ‘Windows’ key, type ‘cmd’, and hit Enter; in Windows 8, you’d need to navigate to the new Modern UI home panel, and just type in ‘cmd’ there.

Once you open the terminal, you need to change the folder to Platform Tools in the Android SDK. Typically, it looks something like this, but you have to find the exact path where you installed the Android SDK on your computer:
C:/Android SDK/adt-bundle-windows-x86_64-20131030/sdk/platform-tools/
To change the folder you just copy the above path (as it is on your computer) and put ‘cd’ in front of it, so the whole command would look like so:
cd C:/Android SDK/adt-bundle-windows-x86_64-20131030/sdk/platform-tools/

3. In the Terminal
Enter the following:
adb devices

Make sure your device is listed.

Next, type in:
adb reboot bootloader

Wait for the phone to reboot in bootloader mode.

4. Now, go to the platform-tools directory (a sub-directory of the Android SDK), and open Command Prompt there (you can do so by Shift + Right-click > Open Command Prompt).

In the command line, enter the following:
fastboot devices

Make sure that your device is listed.

Finally, type in:

fastboot flash recovery FILE.IMG

Replace ‘FILE.IMG’ with the recovery you want to flash. We have given you links for CWM and TWRP at the beginning of the article, but if you've missed them, you would need to download them now from the following links:
Download CWM here
Download TWRP here
Here’s how that recovery file name typically looks (this is the image for a Moto G): 
cwm-6.0.4.6-MotoG4.4.img
cwm-6.0.4.7-MotoG-GPE-4.4.img

twrp-2.6.3.1-MotoG4.4.img

5. After you have flashed the recovery, it is crucial that you you don't just reboot your device. Go to ‘Recovery’ by using volume down to scroll. Don’t scroll using the Volume Up button! In this case, Volume Up serves as the ‘Select’ button. Once you have gone to ‘Recovery’, only then press the Volume Up to boot in recovery mode. 

If you don't follow these instructions, your device will simply re-flash the stock recovery, and you’d have to start all over with the custom recovery flash process.

Wednesday, July 1, 2015

OSI Model

The recommendation X.200 describes seven layers, labeled 1 to 7. Layer 1 is the lowest layer in this model.
OSI Model
LayerData unitFunction[3]Examples
Host
layers
7. ApplicationDataHigh-level APIs, including resource sharing, remote file access, directory servicesand virtual terminalsMailInternet ExplorerFirefox
6. PresentationTranslation of data between a networking service and an application; includingcharacter encodingdata compression and encryption/decryptionASCIIEBCDICJPEG
5. SessionManaging communication sessions, i.e. continuous exchange of information in the form of multiple back-and-forth transmissions between two nodesRPCPAPHTTPFTPSMTPSecure Shell
4. TransportSegmentsReliable transmission of data segments between points on a network, includingsegmentationacknowledgement and multiplexingTCPUDP
Media
layers
3. NetworkPacket/DatagramStructuring and managing a multi-node network, including addressingrouting andtraffic controlIPv4IPv6IPsecAppleTalkICMP
2. Data linkBit/FrameReliable transmission of data frames between two nodes connected by a physical layerPPPIEEE 802.2L2TP
1. PhysicalBitTransmission and reception of raw bit streams over a physical mediumDSLUSB

Berkley Sockets Refresher

Berkley Sockets is a computing library for internet sockets, unix domain sockets and inter process communication.
This list is a summary of functions or methods provided by the Berkeley sockets API library:
  • socket() creates a new socket of a certain socket type, identified by an integer number, and allocates system resources to it.
  • bind() is typically used on the server side, and associates a socket with a socket address structure, i.e. a specified local port number and IP address.
  • listen() is used on the server side, and causes a bound TCP socket to enter listening state.
  • connect() is used on the client side, and assigns a free local port number to a socket. In case of a TCP socket, it causes an attempt to establish a new TCP connection.
  • accept() is used on the server side. It accepts a received incoming attempt to create a new TCP connection from the remote client, and creates a new socket associated with the socket address pair of this connection.
  • send() and recv(), or write() and read(), or sendto() and recvfrom(), are used for sending and receiving data to/from a remote socket.
  • close() causes the system to release resources allocated to a socket. In case of TCP, the connection is terminated.
  • gethostbyname() and gethostbyaddr() are used to resolve host names and addresses. IPv4 only.
  • select() is used to pend, waiting for one or more of a provided list of sockets to be ready to read, ready to write, or that have errors.
  • poll() is used to check on the state of a socket in a set of sockets. The set can be tested to see if any socket can be written to, read from or if an error occurred.
  • getsockopt() is used to retrieve the current value of a particular socket option for the specified socket.
  • setsockopt() is used to set a particular socket option for the specified socket.
socket()
socket() creates an endpoint for communication and returns a file descriptor for the socket. socket() takes three arguments:
  • domain, which specifies the protocol family of the created socket. For example:
    • AF_INET for network protocol IPv4 or
    • AF_INET6 for IPv6.
    • AF_UNIX for local socket (using a file).
  • type, one of:
    • SOCK_STREAM (reliable stream-oriented service or Stream Sockets)
    • SOCK_DGRAM (datagram service or Datagram Sockets)
    • SOCK_SEQPACKET (reliable sequenced packet service), or
    • SOCK_RAW (raw protocols atop the network layer).
  • protocol specifying the actual transport protocol to use. The most common are IPPROTO_TCPIPPROTO_SCTPIPPROTO_UDPIPPROTO_DCCP. These protocols are specified in . The value 0 may be used to select a default protocol from the selected domain and type.
The function returns -1 if an error occurred. Otherwise, it returns an integer representing the newly assigned descriptor.
Prototype
int socket(int domain, int type, int protocol);

bind()

bind() assigns a socket to an address. When a socket is created using socket(), it is only given a protocol family, but not assigned an address. This association with an address must be performed with the bind() system call before the socket can accept connections to other hosts. bind() takes three arguments:
  • sockfd, a descriptor representing the socket to perform the bind on.
  • my_addr, a pointer to a sockaddr structure representing the address to bind to.
  • addrlen, a socklen_t field specifying the size of the sockaddr structure.
Bind() returns 0 on success and -1 if an error occurs.
Prototype
int bind(int sockfd, const struct sockaddr *my_addr, socklen_t addrlen);

listen()[edit]

After a socket has been associated with an address, listen() prepares it for incoming connections. However, this is only necessary for the stream-oriented (connection-oriented) data modes, i.e., for socket types (SOCK_STREAMSOCK_SEQPACKET). listen() requires two arguments:
  • sockfd, a valid socket descriptor.
  • backlog, an integer representing the number of pending connections that can be queued up at any one time. The operating system usually places a cap on this value.
Once a connection is accepted, it is dequeued. On success, 0 is returned. If an error occurs, -1 is returned.
Prototype
int listen(int sockfd, int backlog);

accept()[edit]

When an application is listening for stream-oriented connections from other hosts, it is notified of such events (cf. select() function) and must initialize the connection using theaccept() function. The accept() function creates a new socket for each connection and removes the connection from the listen queue. It takes the following arguments:
  • sockfd, the descriptor of the listening socket that has the connection queued.
  • cliaddr, a pointer to a sockaddr structure to receive the client's address information.
  • addrlen, a pointer to a socklen_t location that specifies the size of the client address structure passed to accept(). When accept() returns, this location indicates how many bytes of the structure were actually used.
The accept() function returns the new socket descriptor for the accepted connection, or -1 if an error occurs. All further communication with the remote host now occurs via this new socket.
Datagram sockets do not require processing by accept() since the receiver may immediately respond to the request using the listening socket.
Prototype
int accept(int sockfd, struct sockaddr *cliaddr, socklen_t *addrlen);

connect()[edit]

The connect() system call connects a socket, identified by its file descriptor, to a remote host specified by that host's address in the argument list.
Certain types of sockets are connectionless, most commonly user datagram protocol sockets. For these sockets, connect takes on a special meaning: the default target for sending and receiving data gets set to the given address, allowing the use of functions such as send() and recv() on connectionless sockets.
connect() returns an integer representing the error code: 0 represents success, while -1 represents an error. Historically, in the BSD-derived systems, the state of a socket descriptor is undefined if the call to connect() fails (as it is specified in the Single Unix Specification), thus, portable applications should close the socket descriptor immediately and obtain a new descriptor with socket(), in the case the call to connect() fails.[3]
Prototype
int connect(int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen);

gethostbyname() and gethostbyaddr()[edit]

The gethostbyname() and gethostbyaddr() functions are used to resolve host names and addresses in the domain name system or the local host's other resolver mechanisms (e.g., /etc/hosts lookup). They return a pointer to an object of type struct hostent, which describes an Internet Protocol host. The functions take the following arguments:
  • name specifies the name of the host. For example: www.wikipedia.org
  • addr specifies a pointer to a struct in_addr containing the address of the host.
  • len specifies the length, in bytes, of addr.
  • type specifies the address family type (e.g., AF_INET) of the host address.
The functions return a NULL pointer in case of error, in which case the external integer h_errno may be checked to see whether this is a temporary failure or an invalid or unknown host. Otherwise a valid struct hostent * is returned.
These functions are not strictly a component of the BSD socket API, but are often used in conjunction with the API functions. Furthermore, these functions are now considered legacy interfaces for querying the domain name system. New functions that are completely protocol-agnostic (supporting IPv6) have been defined. These new function aregetaddrinfo() and getnameinfo(), and are based on a new addrinfo data structure.
Prototypes
struct hostent *gethostbyname(const char *name);
struct hostent *gethostbyaddr(const void *addr, int len, int type);
The following lists a sampling of protocol families (preceded by the standard symbolic identifier) defined in a modern Linux or BSD implementation:
PF_LOCAL, PF_UNIX, PF_FILE
                Local to host (pipes and file-domain)
PF_INET         IP protocol family
PF_AX25         Amateur Radio AX.25
PF_IPX          Novell Internet Protocol
PF_APPLETALK    Appletalk DDP
PF_NETROM       Amateur radio NetROM
PF_BRIDGE       Multiprotocol bridge
PF_ATMPVC       ATM PVCs
PF_X25          Reserved for X.25 project
PF_INET6        IP version 6
PF_ROSE         Amateur Radio X.25 PLP
PF_DECnet       Reserved for DECnet project
PF_NETBEUI      Reserved for 802.2LLC project
PF_SECURITY     Security callback pseudo AF
PF_KEY          PF_KEY key management API
PF_NETLINK, PF_ROUTE
                routing API
PF_PACKET       Packet family
PF_ASH          Ash
PF_ECONET       Acorn Econet
PF_ATMSVC       ATM SVCs
PF_SNA          Linux SNA Project
PF_IRDA         IrDA sockets
PF_PPPOX        PPP over X sockets
PF_WANPIPE      Wanpipe API sockets
PF_BLUETOOTH    Bluetooth sockets
Sources: 
https://en.wikipedia.org/wiki/Berkeley_sockets
http://wiki.treck.com/Introduction_to_BSD_Sockets