Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fbd08273 authored by The Android Open Source Project's avatar The Android Open Source Project Committed by Android Git Automerger
Browse files

am 67e6fcd1: merge from froyo-plus-aosp

Merge commit '67e6fcd1'

* commit '67e6fcd1':
  added vendor ID for http://www.onthegovideo.com/
  Fix build - cpu-features is ARM-specific
  eliminate a compiler warning: signed/unsigned length
  adb: optimize socket-list-walking code
  adb: remove unneeded assignment of id to zero
  adb: clean up 0 --> NULL for pointers
  - creates proper ifc.h and dhcp.h headers for libnetutils
  Adds support for UBFX to JIT and Disassembler
parents 96db405f 67e6fcd1
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -65,8 +65,11 @@ asocket *find_local_socket(unsigned id)
    asocket *result = NULL;

    adb_mutex_lock(&socket_list_lock);
    for(s = local_socket_list.next; s != &local_socket_list && !result; s = s->next) {
        if(s->id == id) result = s;
    for (s = local_socket_list.next; s != &local_socket_list; s = s->next) {
        if (s->id == id) {
            result = s;
            break;
        }
    }
    adb_mutex_unlock(&socket_list_lock);

@@ -366,7 +369,7 @@ static void local_socket_event_func(int fd, unsigned ev, void *_s)
asocket *create_local_socket(int fd)
{
    asocket *s = calloc(1, sizeof(asocket));
    if(s == 0) fatal("cannot allocate socket");
    if (s == NULL) fatal("cannot allocate socket");
    install_local_socket(s);
    s->fd = fd;
    s->enqueue = local_socket_enqueue;
@@ -482,7 +485,7 @@ asocket *create_remote_socket(unsigned id, atransport *t)
    asocket *s = calloc(1, sizeof(aremotesocket));
    adisconnect*  dis = &((aremotesocket*)s)->disconnect;

    if(s == 0) fatal("cannot allocate socket");
    if (s == NULL) fatal("cannot allocate socket");
    s->id = id;
    s->enqueue = remote_socket_enqueue;
    s->ready = remote_socket_ready;
@@ -761,8 +764,7 @@ asocket *create_smart_socket(void (*action_cb)(asocket *s, const char *act))
{
    D("Creating smart socket \n");
    asocket *s = calloc(1, sizeof(asocket));
    if(s == 0) fatal("cannot allocate socket");
    s->id = 0;
    if (s == NULL) fatal("cannot allocate socket");
    s->enqueue = smart_socket_enqueue;
    s->ready = smart_socket_ready;
    s->close = smart_socket_close;
+4 −1
Original line number Diff line number Diff line
@@ -69,6 +69,8 @@
#define VENDOR_ID_PANTECH       0x10A9
// Qualcomm's USB Vendor ID
#define VENDOR_ID_QUALCOMM      0x05c6
// On-The-Go-Video's USB Vendor ID
#define VENDOR_ID_OTGV          0x2257
// NEC's USB Vendor ID
#define VENDOR_ID_NEC           0x0409
// Panasonic Mobile Communication's USB Vendor ID
@@ -94,6 +96,7 @@ int builtInVendorIds[] = {
    VENDOR_ID_KYOCERA,
    VENDOR_ID_PANTECH,
    VENDOR_ID_QUALCOMM,
    VENDOR_ID_OTGV,
    VENDOR_ID_NEC,
    VENDOR_ID_PMC,
};
@@ -157,7 +160,7 @@ void usb_vendors_init(void)
/* builds the path to the adb vendor id file. returns 0 if success */
int build_path(char* buff, size_t len, const char* format, const char* home)
{
    if (snprintf(buff, len, format, home, ANDROID_PATH, ANDROID_ADB_INI) >= len) {
    if (snprintf(buff, len, format, home, ANDROID_PATH, ANDROID_ADB_INI) >= (signed)len) {
        return 1;
    }

+40 −0
Original line number Diff line number Diff line
/*
 * Copyright 2008, The Android Open Source Project
 * Copyright 2010, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
@@ -14,22 +14,27 @@
 * limitations under the License.
 */

#ifndef _IFC_UTILS_H_
#define _IFC_UTILS_H_
#ifndef _NETUTILS_DHCP_H_
#define _NETUTILS_DHCP_H_

int ifc_init(void);
#include <sys/cdefs.h>
#include <arpa/inet.h>

int ifc_get_ifindex(const char *name, int *if_indexp);
int ifc_get_hwaddr(const char *name, void *ptr);
__BEGIN_DECLS

int ifc_up(const char *name);
int ifc_down(const char *name);
extern int do_dhcp(char *iname);
extern int dhcp_do_request(const char *ifname,
                          in_addr_t *ipaddr,
                          in_addr_t *gateway,
                          in_addr_t *mask,
                          in_addr_t *dns1,
                          in_addr_t *dns2,
                          in_addr_t *server,
                          uint32_t  *lease);
extern int dhcp_stop(const char *ifname);
extern int dhcp_release_lease(const char *ifname);
extern char *dhcp_get_errmsg();

int ifc_set_addr(const char *name, unsigned addr);
int ifc_set_mask(const char *name, unsigned mask);
__END_DECLS

int ifc_create_default_route(const char *name, unsigned addr);

int ifc_get_info(const char *name, unsigned *addr, unsigned *mask, unsigned *flags);

#endif
#endif /* _NETUTILS_DHCP_H_ */

include/netutils/ifc.h

0 → 100644
+59 −0
Original line number Diff line number Diff line
/*
 * Copyright 2008, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 *
 *     http://www.apache.org/licenses/LICENSE-2.0 
 *
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License.
 */

#ifndef _NETUTILS_IFC_H_
#define _NETUTILS_IFC_H_

#include <sys/cdefs.h>
#include <arpa/inet.h>

__BEGIN_DECLS

extern int ifc_init(void);
extern void ifc_close(void);

extern int ifc_get_ifindex(const char *name, int *if_indexp);
extern int ifc_get_hwaddr(const char *name, void *ptr);

extern int ifc_up(const char *name);
extern int ifc_down(const char *name);

extern int ifc_enable(const char *ifname);
extern int ifc_disable(const char *ifname);

extern int ifc_reset_connections(const char *ifname);

extern int ifc_set_addr(const char *name, in_addr_t addr);
extern int ifc_set_mask(const char *name, in_addr_t mask);
extern int ifc_set_hwaddr(const char *name, const void *ptr);

extern int ifc_add_host_route(const char *name, in_addr_t addr);
extern int ifc_remove_host_routes(const char *name);
extern int ifc_get_default_route(const char *ifname);
extern int ifc_set_default_route(const char *ifname, in_addr_t gateway);
extern int ifc_create_default_route(const char *name, in_addr_t addr);
extern int ifc_remove_default_route(const char *ifname);

extern int ifc_get_info(const char *name, in_addr_t *addr, in_addr_t *mask,
                        in_addr_t *flags);

extern int ifc_configure(const char *ifname, in_addr_t address,
                         in_addr_t netmask, in_addr_t gateway,
                         in_addr_t dns1, in_addr_t dns2);

__END_DECLS

#endif /* _NETUTILS_IFC_H_ */
+14 −0
Original line number Diff line number Diff line
@@ -115,6 +115,14 @@ static void fill_ip_info(const char *interface,
    }
}

static const char *ipaddr_to_string(in_addr_t addr)
{
    struct in_addr in_addr;

    in_addr.s_addr = addr;
    return inet_ntoa(in_addr);
}

/*
 * Start the dhcp client daemon, and wait for it to finish
 * configuring the interface.
@@ -165,7 +173,13 @@ int dhcp_do_request(const char *interface,
        return -1;
    }
    if (strcmp(prop_value, "ok") == 0) {
        char dns_prop_name[PROPERTY_KEY_MAX];
        fill_ip_info(interface, ipaddr, gateway, mask, dns1, dns2, server, lease);
        /* copy the dhcp.XXX.dns properties to net.XXX.dns */
        snprintf(dns_prop_name, sizeof(dns_prop_name), "net.%s.dns1", interface);
        property_set(dns_prop_name, *dns1 ? ipaddr_to_string(*dns1) : "");
        snprintf(dns_prop_name, sizeof(dns_prop_name), "net.%s.dns2", interface);
        property_set(dns_prop_name, *dns2 ? ipaddr_to_string(*dns2) : "");
        return 0;
    } else {
        snprintf(errmsg, sizeof(errmsg), "DHCP result was %s", prop_value);
Loading