/// return special devicetype to target the right platform
16731
func handleAppVariantType(service *push.Service, appName string, appVariant string) string {
	// custom apps have separate certificate
	base := getKey("SNS_BASE", true) // 'arn:aws:sns:eu-west-1:123454678:app'
	env := getKey("ENVIRONMENT", true)
	specialType := "ios_" + appVariant
	if _, ok := service.Platforms[specialType]; !ok {
		service.Platforms[specialType] = fmt.Sprintf("%v/%v/%v_%v_%v", base, "APNS", env, appName, appVariant)
	}
	return specialType
}
101307
func (service *VboxPortType) IAppliancegetMachines(request *IAppliancegetMachines) (*IAppliancegetMachinesResponse, error) {
	response := new(IAppliancegetMachinesResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
652544
func devicePrefix() (string, error) {
	available := []string{"sd", "xvd"}

	f, err := os.Open("/sys/block")
	if err != nil {
		return "", err
	}
	defer f.Close()

	dirs, err := f.Readdirnames(-1)
	if dirs != nil && len(dirs) > 0 {
		for _, dir := range dirs {
			dirBase := filepath.Base(dir)
			for _, prefix := range available {
				if strings.HasPrefix(dirBase, prefix) {
					return prefix, nil
				}
			}
		}
	}

	if err != nil {
		return "", err
	}

	return "", errors.New("device prefix could not be detected")
}
819413
func SensorGetDeviceType(deviceIndex int) (typ SensorType) {
	typ = SensorType(C.SDL_SensorGetDeviceType(C.int(deviceIndex)))
	return
}
8897
func NewDeviceLinkFailDetails(DeviceType *DeviceType) *DeviceLinkFailDetails {
	s := new(DeviceLinkFailDetails)
	s.DeviceType = DeviceType
	return s
}
1039228
func JoystickGetDeviceType(index int) JoystickType {
	return JoystickType(C.SDL_JoystickGetDeviceType(C.int(index)))
}
856306
func (a *Application) deviceConstraintsKey() string {
	return applicationDeviceConstraintsKey(a.doc.Name, a.doc.CharmURL)
}
1011203
func (d *DeviceMapperDriver) deviceSize(deviceHash string) (uint64, error) {
	return getDeviceSize(d.devicePath(deviceHash))
}
780354
func (service *VboxPortType) IHostgetUSBDeviceFilters(request *IHostgetUSBDeviceFilters) (*IHostgetUSBDeviceFiltersResponse, error) {
	response := new(IHostgetUSBDeviceFiltersResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
406992
func (e *loginProvision) deviceWithType(m libkb.MetaContext, provisionerType keybase1.DeviceType) (err error) {
	defer m.Trace("loginProvision#deviceWithType", func() error { return err })()

	// make a new device:
	deviceID, err := libkb.NewDeviceID()
	if err != nil {
		return err
	}
	device := &libkb.Device{
		ID:   deviceID,
		Type: e.arg.DeviceType,
	}

	// prompt for the device name here so there's no delay during kex:
	m.Debug("deviceWithType: prompting for device name")
	name, err := e.deviceName(m)
	if err != nil {
		m.Debug("deviceWithType: error getting device name from user: %s", err)
		return err
	}
	device.Description = &name
	m.Debug("deviceWithType: got device name: %q", name)

	// make a new secret:
	uid := m.CurrentUID()

	// Continue to generate legacy Kex2 secret types
	kex2SecretTyp := libkb.Kex2SecretTypeV1Desktop
	if e.arg.DeviceType == libkb.DeviceTypeMobile || provisionerType == keybase1.DeviceType_MOBILE {
		kex2SecretTyp = libkb.Kex2SecretTypeV1Mobile
	}
	m.Debug("Generating Kex2 secret for uid=%s, typ=%d", uid, kex2SecretTyp)
	secret, err := libkb.NewKex2SecretFromTypeAndUID(kex2SecretTyp, uid)
	if err != nil {
		return err
	}

	// create provisionee engine
	salt, err := e.arg.User.GetSalt()
	if err != nil {
		m.Debug("Failed to get salt")
		return err
	}
	provisionee := NewKex2Provisionee(m.G(), device, secret.Secret(), e.arg.User.GetUID(), salt)

	var canceler func()

	// display secret and prompt for secret from X in a goroutine:
	go func() {
		sb := secret.Secret()
		arg := keybase1.DisplayAndPromptSecretArg{
			Secret:          sb[:],
			Phrase:          secret.Phrase(),
			OtherDeviceType: provisionerType,
		}
		var contxt context.Context
		contxt, canceler = context.WithCancel(context.Background())
		for i := 0; i < 10; i++ {
			receivedSecret, err := m.UIs().ProvisionUI.DisplayAndPromptSecret(contxt, arg)
			if err != nil {
				// cancel provisionee run:
				provisionee.Cancel()
				m.Warning("DisplayAndPromptSecret error: %s", err)
				break
			} else if receivedSecret.Secret != nil && len(receivedSecret.Secret) > 0 {
				m.Debug("received secret, adding to provisionee")
				var ks kex2.Secret
				copy(ks[:], receivedSecret.Secret)
				provisionee.AddSecret(ks)
				break
			} else if len(receivedSecret.Phrase) > 0 {
				m.Debug("received secret phrase, checking validity")
				checker := libkb.MakeCheckKex2SecretPhrase(m.G())
				if !checker.F(receivedSecret.Phrase) {
					m.Debug("secret phrase failed validity check (attempt %d)", i)
					arg.PreviousErr = checker.Hint
					continue
				}
				m.Debug("received secret phrase, adding to provisionee")
				ks, err := libkb.NewKex2SecretFromUIDAndPhrase(uid, receivedSecret.Phrase)
				if err != nil {
					m.Warning("DisplayAndPromptSecret error: %s", err)
				} else {
					provisionee.AddSecret(ks.Secret())
				}
				break
			} else {
				// empty secret, so must have been a display-only case.
				// ok to stop the loop
				m.Debug("login provision DisplayAndPromptSecret returned empty secret, stopping retry loop")
				break
			}
		}
	}()

	defer func() {
		if canceler != nil {
			m.Debug("canceling DisplayAndPromptSecret call")
			canceler()
		}
	}()

	err = RunEngine2(m, provisionee)
	if err != nil {
		return err
	}

	e.saveToSecretStoreWithLKS(m, provisionee.GetLKSec())

	e.signingKey, err = provisionee.SigningKey()
	if err != nil {
		return err
	}
	e.encryptionKey, err = provisionee.EncryptionKey()
	if err != nil {
		return err
	}

	// Load me again so that keys will be up to date.
	loadArg := libkb.NewLoadUserArgWithMetaContext(m).WithSelf(true).WithUID(e.arg.User.GetUID())
	e.arg.User, err = libkb.LoadUser(loadArg)
	if err != nil {
		return err
	}

	// need username, device name for ProvisionUI.ProvisioneeSuccess()
	e.username = provisionee.GetName()
	pdevice := provisionee.Device()
	if pdevice == nil {
		m.Warning("nil provisionee device")
	} else if pdevice.Description == nil {
		m.Warning("nil provisionee device description")
	} else {
		e.devname = *pdevice.Description
	}

	return nil
}
205769
func NewDeviceLinkFailType(Description string) *DeviceLinkFailType {
	s := new(DeviceLinkFailType)
	s.Description = Description
	return s
}
349678
func DeviceProximity(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "deviceproximity", Listener: listener}
}
956588
func (r User_Customer_MobileDevice) GetType() (resp datatypes.User_Customer_MobileDevice_Type, err error) {
	err = r.Session.DoRequest("SoftLayer_User_Customer_MobileDevice", "getType", nil, &r.Options, &resp)
	return
}
1123891
func GetBridgedDevices() ([]string, error) {
	deviceNames := []string{}
	ifAndMac, err := getBridgedDeviceKV("Name", "HardwareAddress")
	if err != nil {
		return deviceNames, err
	}
	for _, kv := range ifAndMac {
		if kv.k != "" && kv.v != "" {
			deviceNames = append(deviceNames, kv.k)
		}
	}
	return deviceNames, nil
}
812140
func (ckf *ComputedKeyFamily) GetDeviceForKey(key GenericKey) (*Device, error) {
	return ckf.GetDeviceForKID(key.GetKID())
}
443312
func NewDeviceApprovalsChangeOverageActionType(Description string) *DeviceApprovalsChangeOverageActionType {
	s := new(DeviceApprovalsChangeOverageActionType)
	s.Description = Description
	return s
}
250489
func NewDeviceChangeIpDesktopType(Description string) *DeviceChangeIpDesktopType {
	s := new(DeviceChangeIpDesktopType)
	s.Description = Description
	return s
}